Prechádzať zdrojové kódy

Merged revisions 2348-2351,2361,2366,2370-2371,2377,2379,2383,2388-2389,2401,2425,2428,2430-2431,2447 via svnmerge from
http://[email protected]/svn/fpc/trunk

........
r2348 | daniel | 2006-01-26 23:14:46 +0100 (Thu, 26 Jan 2006) | 2 lines

* Another libc dependency less

........
r2349 | daniel | 2006-01-27 11:28:58 +0100 (Fri, 27 Jan 2006) | 2 lines

+ Very aggressive vcsa detection

........
r2350 | daniel | 2006-01-27 11:36:46 +0100 (Fri, 27 Jan 2006) | 2 lines

* Better error handling

........
r2351 | daniel | 2006-01-27 11:46:26 +0100 (Fri, 27 Jan 2006) | 2 lines

+ Much more agressive VCSA detection. Now works from inside Midnight Commander.

........
r2361 | daniel | 2006-01-28 23:21:28 +0100 (Sat, 28 Jan 2006) | 4 lines

* Overhaul of key recognition codes. Should recognize key much
better now, even without terminfo, which has been removed so another
libc dependency is gone.

........
r2366 | daniel | 2006-01-29 00:17:48 +0100 (Sun, 29 Jan 2006) | 3 lines

* vcsa functionality moved into linuxvcs unit
* Reverse ifdef in gpm

........
r2370 | daniel | 2006-01-29 09:00:16 +0100 (Sun, 29 Jan 2006) | 2 lines

* Fix 2.0.0 compat

........
r2371 | daniel | 2006-01-29 09:28:46 +0100 (Sun, 29 Jan 2006) | 2 lines

* Comitted too quickly

........
r2377 | tom_at_work | 2006-01-29 18:54:04 +0100 (Sun, 29 Jan 2006) | 1 line

* added __stkptr global in cprt0 for powerpc/linux
........
r2379 | daniel | 2006-01-29 19:15:50 +0100 (Sun, 29 Jan 2006) | 2 lines

* 2.0 workaround

........
r2383 | daniel | 2006-01-31 11:26:25 +0100 (Tue, 31 Jan 2006) | 9 lines

+ Keyboard unit overhaul
+ Shift+arrow keys now working in xterm
+ Keyboard restored when vt-switching away from application on Linux
console
+ Escape key remapped on Linux console so it works instantly.
+ Try to use Linux console more aggressively
+ Linux specific code now only executed on Linux terminals and not
on xterm, FreeBSD etc.

........
r2388 | peter | 2006-02-01 07:34:31 +0100 (Wed, 01 Feb 2006) | 2 lines

* remove useless comment

........
r2389 | daniel | 2006-02-01 09:27:30 +0100 (Wed, 01 Feb 2006) | 2 lines

* Remove debugging code.

........
r2401 | daniel | 2006-02-02 09:22:35 +0100 (Thu, 02 Feb 2006) | 5 lines

* various bugfixes
- Disable shared linking for now since it since it simply breaks
svn. (Already disabled in Makefile itself, likely accidentally
done with an old FPCMake, but it "fixed" svn to compile.)

........
r2425 | daniel | 2006-02-04 09:31:18 +0100 (Sat, 04 Feb 2006) | 3 lines

* FreeBSD delete key
* Alt+Backspace in xterm

........
r2428 | daniel | 2006-02-04 15:30:42 +0100 (Sat, 04 Feb 2006) | 5 lines

+ Added ability to use ctrl+x,ctrl+c,ctrl+v for clipboard. Enabled by
default on Unix platforms because normal shift+ins is not available in
a lot of terminal emulators. Currently only configurable through
INI-file. UI will follow.

........
r2430 | daniel | 2006-02-04 17:09:11 +0100 (Sat, 04 Feb 2006) | 2 lines

+ UI for selecting edit key set.

........
r2431 | daniel | 2006-02-04 17:22:36 +0100 (Sat, 04 Feb 2006) | 2 lines

* Remove terminfo use. IDE now libc free when build without debugger.

........
r2447 | daniel | 2006-02-05 21:54:07 +0100 (Sun, 05 Feb 2006) | 2 lines

* Fix compilation on non-Unix

........

git-svn-id: branches/fixes_2_0@2588 -

peter 19 rokov pred
rodič
commit
c7a7dfb185

+ 1 - 0
.gitattributes

@@ -3689,6 +3689,7 @@ rtl/linux/i386/syscallh.inc svneol=native#text/plain
 rtl/linux/i386/sysnr.inc svneol=native#text/plain
 rtl/linux/ipccall.inc svneol=native#text/plain
 rtl/linux/ipcsys.inc svneol=native#text/plain
+rtl/linux/linuxvcs.pp -text
 rtl/linux/m68k/bsyscall.inc svneol=native#text/plain
 rtl/linux/m68k/prt0.as -text
 rtl/linux/m68k/prt1.as -text

+ 3 - 0
ide/fp.pas

@@ -346,6 +346,9 @@ BEGIN
   InitDesktopFile;
   LoadDesktop;
 
+  {Menubar might be changed because of loading INI file.}
+  IDEapp.reload_menubar;
+
   { Handle Standard Units }
   if UseAllUnitsInCodeComplete then
     AddAvailableUnitsToCodeComplete(false);

+ 50 - 5
ide/fpide.pas

@@ -32,6 +32,7 @@ type
       constructor Init;
       procedure   InitDesktop; virtual;
       procedure   InitMenuBar; virtual;
+      procedure   reload_menubar;
       procedure   InitStatusLine; virtual;
       procedure   Open(FileName: string;FileDir:string);
       function    OpenSearch(FileName: string) : boolean;
@@ -154,6 +155,15 @@ procedure PutCommand(TargetView: PView; What, Command: Word; InfoPtr: Pointer);
 var
   IDEApp: TIDEApp;
 
+{Configurable keys.}
+const menu_key_edit_cut:string[63]=menu_key_edit_cut_borland;
+      menu_key_edit_copy:string[63]=menu_key_edit_copy_borland;
+      menu_key_edit_paste:string[63]=menu_key_edit_paste_borland;
+      menu_key_hlplocal_copy:string[63]=menu_key_hlplocal_copy_borland;
+      cut_key:word=kbShiftDel;
+      copy_key:word=kbCtrlIns;
+      paste_key:word=kbShiftIns;
+
 implementation
 
 uses
@@ -293,8 +303,10 @@ begin
 end;
 
 procedure TIDEApp.InitMenuBar;
+
 var R: TRect;
     WinPMI : PMenuItem;
+
 begin
   GetExtent(R); R.B.Y:=R.A.Y+1;
   WinPMI:=nil;
@@ -331,9 +343,9 @@ begin
       NewItem('R~e~do All','', kbNoKey, cmRedoAll, hcRedo,
 {$endif DebugUndo}
       NewLine(
-      NewItem(menu_edit_cut,menu_key_edit_cut, kbShiftDel, cmCut, hcCut,
-      NewItem(menu_edit_copy,menu_key_edit_copy, kbCtrlIns, cmCopy, hcCut,
-      NewItem(menu_edit_paste,menu_key_edit_paste, kbShiftIns, cmPaste, hcPaste,
+      NewItem(menu_edit_cut,menu_key_edit_cut, cut_key, cmCut, hcCut,
+      NewItem(menu_edit_copy,menu_key_edit_copy, copy_key, cmCopy, hcCut,
+      NewItem(menu_edit_paste,menu_key_edit_paste, paste_key, cmPaste, hcPaste,
       NewItem(menu_edit_clear,menu_key_edit_clear, kbCtrlDel, cmClear, hcClear,
       NewItem(menu_edit_selectall,'', kbNoKey, cmSelectAll, hcSelectAll,
       NewItem(menu_edit_unselect,'', kbNoKey, cmUnselect, hcUnselect,
@@ -429,7 +441,7 @@ begin
         NewItem(menu_options_env_codecomplete,'', kbNoKey, cmCodeCompleteOptions, hcCodeCompleteOptions,
         NewItem(menu_options_env_codetemplates,'', kbNoKey, cmCodeTemplateOptions, hcCodeTemplateOptions,
         NewItem(menu_options_env_desktop,'', kbNoKey, cmDesktopOptions, hcDesktopOptions,
-        NewItem(menu_options_env_mouse,'', kbNoKey, cmMouse, hcMouse,
+        NewItem(menu_options_env_keybmouse,'', kbNoKey, cmMouse, hcMouse,
         NewItem(menu_options_env_startup,'', kbNoKey, cmStartup, hcStartup,
         NewItem(menu_options_env_colors,'', kbNoKey, cmColors, hcColors,
 {$ifdef Unix}
@@ -479,6 +491,37 @@ begin
   // Update; Desktop is still nil at that point ...
 end;
 
+procedure Tideapp.reload_menubar;
+
+begin
+   delete(menubar);
+   dispose(menubar,done);
+   case EditKeys of
+     ekm_microsoft:
+       begin
+         menu_key_edit_cut:=menu_key_edit_cut_microsoft;
+         menu_key_edit_copy:=menu_key_edit_copy_microsoft;
+         menu_key_edit_paste:=menu_key_edit_paste_microsoft;
+         menu_key_hlplocal_copy:=menu_key_hlplocal_copy_microsoft;
+         cut_key:=kbCtrlX;
+         copy_key:=kbCtrlC;
+         paste_key:=kbCtrlV;
+       end;
+     ekm_borland:
+       begin
+         menu_key_edit_cut:=menu_key_edit_cut_borland;
+         menu_key_edit_copy:=menu_key_edit_copy_borland;
+         menu_key_edit_paste:=menu_key_edit_paste_borland;
+         menu_key_hlplocal_copy:=menu_key_hlplocal_copy_borland;
+         cut_key:=kbShiftDel;
+         copy_key:=kbCtrlIns;
+         paste_key:=kbShiftIns;
+       end;
+   end;
+   initmenubar;
+   insert(menubar);
+end;
+
 procedure TIDEApp.InitStatusLine;
 var
   R: TRect;
@@ -1255,4 +1298,6 @@ begin
   DoneHelpSystem;
 end;
 
-END.
+
+
+end.

+ 17 - 1
ide/fpini.pas

@@ -40,7 +40,7 @@ uses
 {$endif USE_EXTERNAL_COMPILER}
   WConsts,WUtils,WINI,WViews,WEditor,WCEdit,
   {$ifndef NODEBUG}FPDebug,{$endif}FPConst,FPVars,
-  FPIntf,FPTools,FPSwitch,FPString;
+  FPIntf,FPTools,FPSwitch,FPString,fpccrc;
 
 const
   PrinterDevice : string = 'prn';
@@ -69,6 +69,7 @@ const
   secBreakpoint  = 'Breakpoints';
   secWatches     = 'Watches';
   secHighlight   = 'Highlight';
+  secKeyboard    = 'Keyboard';
   secMouse       = 'Mouse';
   secSearch      = 'Search';
   secTools       = 'Tools';
@@ -127,6 +128,7 @@ const
   ieDesktopFlags     = 'DesktopFileFlags';
   ieCenterDebuggerRow= 'CenterCurrentLineWhileDebugging';
   ieShowReadme       = 'ShowReadme';
+  ieEditKeys         = 'EditKeys';
 
 
 Procedure InitDirs;
@@ -413,6 +415,15 @@ begin
   MouseReverse:=boolean(INIFile^.GetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse)));
   AltMouseAction:=INIFile^.GetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   CtrlMouseAction:=INIFile^.GetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
+  {Keyboard}
+  case crc32(upcase(INIFile^.GetEntry(secKeyboard,ieEditKeys,''))) of
+    $86a4c898: {crc32 for 'MICROSOFT'} 
+      EditKeys:=ekm_microsoft;
+    $b20b87b3: {crc32 for 'BORLAND'}
+      EditKeys:=ekm_borland;
+    else
+      EditKeys:=ekm_default;
+  end;
   { Search }
   FindFlags:=INIFile^.GetIntEntry(secSearch,ieFindFlags,FindFlags);
   { Breakpoints }
@@ -601,6 +612,11 @@ begin
   INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
   INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
+  { Keyboard }
+  if EditKeys=ekm_microsoft then
+    INIFile^.SetEntry(secKeyboard,ieEditKeys,'microsoft')
+  else
+    INIFile^.SetEntry(secKeyboard,ieEditKeys,'borland');
   { Search }
   INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
   { Breakpoints }

+ 20 - 4
ide/fpmopts.inc

@@ -1178,14 +1178,24 @@ var R,R2: TRect;
     D: PCenterDialog;
     SB: PScrollBar;
     CB: PCheckBoxes;
-    RB1,RB2: PRadioButtons;
+    RB1,RB2,RBKB: PRadioButtons;
 begin
-  R.Assign(0,0,62,15);
+  R.Assign(0,0,62,19);
   New(D, Init(R, dialog_mouseoptions));
   with D^ do
   begin
     HelpCtx:=hcMouse;
-    GetExtent(R); R.Grow(-3,-2); R.B.Y:=R.A.Y+3;
+    GetExtent(R); R.Grow(-3,-2); inc(R.A.Y); R.B.Y:=R.A.Y+2;
+    New(RBkb, Init(R,
+      NewSItem('~B~orland convention (Shift+Del,Ctrl+Ins,Shift+Ins)',
+      NewSItem('~M~icrosoft convention (Ctrl+X,Ctrl+C,Ctrl+V)',
+      nil))));
+    RBkb^.Press(integer(EditKeys));
+    Insert(RBkb);
+    R.move(0,-1); R.B.Y:=R.A.Y+1;
+    Insert(New(PLabel, Init(R, '~K~eys for cut, copy and paste:', RBkb)));
+
+    R.Move(0,(R.B.Y-R.A.Y)+3); R.B.Y:=R.A.Y+3;
     R2.Copy(R); Inc(R2.A.Y,2); R2.B.X:=R2.A.X+(R2.B.X-R2.A.X) div 2 -1;
     New(SB, Init(R2)); SB^.GrowMode:=0; SB^.Options:=SB^.Options or ofSelectable;
     SB^.SetParams(DoubleDelay,1,20,1,1);
@@ -1232,13 +1242,19 @@ begin
     Insert(New(PLabel, Init(R2,  label_mouse_altrightmousebuttonaction, RB2)));
   end;
   InsertButtons(D);
-  RB1^.Select;
+
+  RBkb^.Select;
   if Desktop^.ExecView(D)=cmOK then
   begin
     MouseReverse:=CB^.Mark(0);
     DoubleDelay:=SB^.Value;
     CtrlMouseAction:=RB1^.Value;
     AltMouseAction:=RB2^.Value;
+    if Tedit_key_modes(RBkb^.value)<>EditKeys then
+      begin
+        EditKeys:=Tedit_key_modes(RBkb^.value);
+        reload_menubar;
+      end;
   end;
   Dispose(D, Done);
 end;

+ 22 - 17
ide/fpstre.inc

@@ -27,10 +27,11 @@ const
       menu_common_prevtopic    = '~P~revious topic';
       menu_common_copy = '~C~opy';
 
-      menu_key_common_helpindex = 'Shift+F1';
-      menu_key_common_topicsearch = 'Ctrl+F1';
-      menu_key_common_prevtopic = 'Alt+F1';
-      menu_key_common_copy = 'Ctrl+Ins';
+      menu_key_common_helpindex      = 'Shift+F1';
+      menu_key_common_topicsearch    = 'Ctrl+F1';
+      menu_key_common_prevtopic      = 'Alt+F1';
+      menu_key_common_copy_borland   = 'Ctrl+Ins';
+      menu_key_common_copy_microsoft = 'Ctrl+C';
 
       { Symbol browser tabs }
       label_browsertab_scope = 'S';
@@ -143,7 +144,7 @@ const
       menu_options_env_codecomplete = 'Code~C~omplete...';
       menu_options_env_codetemplates = 'Code~T~emplates...';
       menu_options_env_desktop = '~D~esktop...';
-      menu_options_env_mouse = '~M~ouse...';
+      menu_options_env_keybmouse = 'Keyboard & ~m~ouse...';
       menu_options_env_startup = '~S~tartup...';
       menu_options_env_colors= '~C~olors';
       menu_options_learn_keys= 'Learn ~K~eys';
@@ -216,9 +217,12 @@ const
       menu_key_file_exit     = 'Alt+X';
 
       menu_key_edit_undo     = 'Alt+BkSp';
-      menu_key_edit_cut      = 'Shift+Del';
-      menu_key_edit_copy     = menu_key_common_copy;
-      menu_key_edit_paste    = 'Shift+Ins';
+      menu_key_edit_cut_borland      = 'Shift+Del';
+      menu_key_edit_copy_borland     = menu_key_common_copy_borland;
+      menu_key_edit_paste_borland    = 'Shift+Ins';
+      menu_key_edit_cut_microsoft    = 'Ctrl+X';
+      menu_key_edit_copy_microsoft   = menu_key_common_copy_microsoft;
+      menu_key_edit_paste_microsoft  = 'Ctrl+V';
       menu_key_edit_clear    = 'Ctrl+Del';
 
       menu_key_run_run       = 'Ctrl+F9';
@@ -256,7 +260,8 @@ const
       menu_key_hlplocal_index = menu_key_common_helpindex;
       menu_key_hlplocal_topicsearch = menu_key_common_topicsearch;
       menu_key_hlplocal_prevtopic = menu_key_common_prevtopic;
-      menu_key_hlplocal_copy = menu_key_common_copy;
+      menu_key_hlplocal_copy_borland = menu_key_common_copy_borland;
+      menu_key_hlplocal_copy_microsoft = menu_key_common_copy_microsoft;
 
       dialog_openafile        = 'Open a file';
       label_filetoopen        = 'File to ope~n~';
@@ -445,17 +450,17 @@ const
 
       dialog_mouseoptions = 'Mouse Options';
       label_mouse_speedbar = 'Fast       Medium      Slow';
-      label_mouse_doubleclickspeed = '~M~ouse double click';
+      label_mouse_doubleclickspeed = 'Mouse ~d~ouble click';
       label_mouse_reversebuttons = '~R~everse mouse buttons';
       label_mouse_crtlrightmousebuttonaction = 'Ctrl+Right mouse button';
       label_mouse_altrightmousebuttonaction = 'Alt+Right mouse button';
-      label_mouse_act_nothing = '~N~othing';
-      label_mouse_act_topicsearch = '~T~opic search';
-      label_mouse_act_gotocursor = '~G~o to cursor';
-      label_mouse_act_breakpoint = '~B~reakpoint';
-      label_mouse_act_evaluate = '~E~valuate';
-      label_mouse_act_addwatch = '~A~dd watch';
-      label_mouse_act_browsesymbol = 'Browse ~s~ymbol';
+      label_mouse_act_nothing = 'Nothing';
+      label_mouse_act_topicsearch = 'Topic search';
+      label_mouse_act_gotocursor = 'Go to cursor';
+      label_mouse_act_breakpoint = 'Breakpoint';
+      label_mouse_act_evaluate = 'Evaluate';
+      label_mouse_act_addwatch = 'Add watch';
+      label_mouse_act_browsesymbol = 'Browse symbol';
 
       label_colors_grp_browser = 'Browser';
       label_colors_framepassive = 'Frame passive';

+ 1 - 1
ide/fpstrh.inc

@@ -131,7 +131,7 @@ const
       menu_options_env_codecomplete = 'Code~C~omplete...';
       menu_options_env_codetemplates = 'Code~T~emplates...';
       menu_options_env_desktop = '~A~sztal...';
-      menu_options_env_mouse = 'E~g~‚r...';
+      menu_options_env_keybmouse = 'Keyboard E~g~‚r...';
       menu_options_env_startup = '~I~ndul s...';
       menu_options_env_colors= 'Sz¡~n~ek';
       menu_options_learn_keys= 'Learn ~K~eys';{ NOT TRANSLATED }

+ 16 - 0
ide/fpvars.pas

@@ -33,6 +33,20 @@ type
     TCompPhase = (cpNothing,cpCompiling,cpLinking,
                   cpAborted,cpFailed,cpDone);
 
+    {Use edit keys according to Borland convention (shift+del,ctrl+ins,shift+ins)
+     or Microsoft convention (ctrl+x,ctrl+c,ctrl+v).}
+    Tedit_key_modes=(ekm_borland,ekm_microsoft);
+
+
+{$ifdef Unix}
+      {Microsoft convention is default on Unix, because the Borland "paste" key, Shift+Ins,
+       is not passed on to the program in most X terminal emulators.}
+const ekm_default = ekm_microsoft;
+{$else}
+const ekm_default = ekm_borland;
+{$endif}
+
+
 const ClipboardWindow  : PClipboardWindow = nil;
       CalcWindow       : PCalculator = nil;
       RecentFileCount  : integer = 0;
@@ -103,6 +117,8 @@ const ClipboardWindow  : PClipboardWindow = nil;
       ShowReadme       : boolean = true;
       AskRecompileIfModifiedFlag : boolean = true;
 
+      EditKeys:Tedit_key_modes = ekm_default;
+
 {$ifdef SUPPORT_REMOTE}
      RemoteMachine : string = '';
      RemotePort : string = '2345';

+ 4 - 4
ide/fpviews.pas

@@ -1668,9 +1668,9 @@ var M: PMenu;
     MI: PMenuItem;
 begin
   MI:=
-    NewItem(menu_edit_cut,menu_key_edit_cut,kbShiftDel,cmCut,hcCut,
-    NewItem(menu_edit_copy,menu_key_edit_copy,kbCtrlIns,cmCopy,hcCopy,
-    NewItem(menu_edit_paste,menu_key_edit_paste,kbShiftIns,cmPaste,hcPaste,
+    NewItem(menu_edit_cut,menu_key_edit_cut,cut_key,cmCut,hcCut,
+    NewItem(menu_edit_copy,menu_key_edit_copy,copy_key,cmCopy,hcCopy,
+    NewItem(menu_edit_paste,menu_key_edit_paste,paste_key,cmPaste,hcPaste,
     NewItem(menu_edit_clear,menu_key_edit_clear,kbCtrlDel,cmClear,hcClear,
     NewLine(
     NewItem(menu_srclocal_openfileatcursor,'',kbNoKey,cmOpenAtCursor,hcOpenAtCursor,
@@ -1958,7 +1958,7 @@ begin
     NewItem(menu_hlplocal_topicsearch,menu_key_hlplocal_topicsearch,kbCtrlF1,cmHelpTopicSearch,hcHelpTopicSearch,
     NewItem(menu_hlplocal_prevtopic,menu_key_hlplocal_prevtopic,kbAltF1,cmHelpPrevTopic,hcHelpPrevTopic,
     NewLine(
-    NewItem(menu_hlplocal_copy,menu_key_hlplocal_copy,kbCtrlIns,cmCopy,hcCopy,
+    NewItem(menu_hlplocal_copy,menu_key_hlplocal_copy,copy_key,cmCopy,hcCopy,
     nil)))))));
   GetLocalMenu:=M;
 end;

+ 0 - 2
ide/wconsole.pas

@@ -17,7 +17,6 @@ unit WConsole;
 interface
 {$ifdef UNIX}
    uses
-     TermInfo,
 {$Ifdef ver1_0}
      linux;
 {$else}
@@ -43,7 +42,6 @@ interface
       longint
 {$endif netware}
     ;
-
 Procedure SaveConsoleMode(var ConsoleMode : TConsoleMode);
 Procedure RestoreConsoleMode(const ConsoleMode : TConsoleMode);
 

+ 53 - 47
rtl/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/06]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/13]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -256,6 +256,9 @@ endif
 ifeq ($(FULL_TARGET),i386-netware)
 override TARGET_DIRS+=netware
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_DIRS+=darwin
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_DIRS+=emx
 endif
@@ -1545,6 +1548,9 @@ endif
 ifeq ($(FULL_TARGET),i386-netware)
 TARGET_DIRS_NETWARE=1
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_DIRS_DARWIN=1
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 TARGET_DIRS_EMX=1
 endif
@@ -1962,6 +1968,51 @@ netware:
 	$(MAKE) -C netware all
 .PHONY: netware_all netware_debug netware_smart netware_release netware_units netware_examples netware_shared netware_install netware_sourceinstall netware_exampleinstall netware_distinstall netware_zipinstall netware_zipsourceinstall netware_zipexampleinstall netware_zipdistinstall netware_clean netware_distclean netware_cleanall netware_info netware_makefiles netware
 endif
+ifdef TARGET_DIRS_DARWIN
+darwin_all:
+	$(MAKE) -C darwin all
+darwin_debug:
+	$(MAKE) -C darwin debug
+darwin_smart:
+	$(MAKE) -C darwin smart
+darwin_release:
+	$(MAKE) -C darwin release
+darwin_units:
+	$(MAKE) -C darwin units
+darwin_examples:
+	$(MAKE) -C darwin examples
+darwin_shared:
+	$(MAKE) -C darwin shared
+darwin_install:
+	$(MAKE) -C darwin install
+darwin_sourceinstall:
+	$(MAKE) -C darwin sourceinstall
+darwin_exampleinstall:
+	$(MAKE) -C darwin exampleinstall
+darwin_distinstall:
+	$(MAKE) -C darwin distinstall
+darwin_zipinstall:
+	$(MAKE) -C darwin zipinstall
+darwin_zipsourceinstall:
+	$(MAKE) -C darwin zipsourceinstall
+darwin_zipexampleinstall:
+	$(MAKE) -C darwin zipexampleinstall
+darwin_zipdistinstall:
+	$(MAKE) -C darwin zipdistinstall
+darwin_clean:
+	$(MAKE) -C darwin clean
+darwin_distclean:
+	$(MAKE) -C darwin distclean
+darwin_cleanall:
+	$(MAKE) -C darwin cleanall
+darwin_info:
+	$(MAKE) -C darwin info
+darwin_makefiles:
+	$(MAKE) -C darwin makefiles
+darwin:
+	$(MAKE) -C darwin all
+.PHONY: darwin_all darwin_debug darwin_smart darwin_release darwin_units darwin_examples darwin_shared darwin_install darwin_sourceinstall darwin_exampleinstall darwin_distinstall darwin_zipinstall darwin_zipsourceinstall darwin_zipexampleinstall darwin_zipdistinstall darwin_clean darwin_distclean darwin_cleanall darwin_info darwin_makefiles darwin
+endif
 ifdef TARGET_DIRS_EMX
 emx_all:
 	$(MAKE) -C emx all
@@ -2187,51 +2238,6 @@ macos:
 	$(MAKE) -C macos all
 .PHONY: macos_all macos_debug macos_smart macos_release macos_units macos_examples macos_shared macos_install macos_sourceinstall macos_exampleinstall macos_distinstall macos_zipinstall macos_zipsourceinstall macos_zipexampleinstall macos_zipdistinstall macos_clean macos_distclean macos_cleanall macos_info macos_makefiles macos
 endif
-ifdef TARGET_DIRS_DARWIN
-darwin_all:
-	$(MAKE) -C darwin all
-darwin_debug:
-	$(MAKE) -C darwin debug
-darwin_smart:
-	$(MAKE) -C darwin smart
-darwin_release:
-	$(MAKE) -C darwin release
-darwin_units:
-	$(MAKE) -C darwin units
-darwin_examples:
-	$(MAKE) -C darwin examples
-darwin_shared:
-	$(MAKE) -C darwin shared
-darwin_install:
-	$(MAKE) -C darwin install
-darwin_sourceinstall:
-	$(MAKE) -C darwin sourceinstall
-darwin_exampleinstall:
-	$(MAKE) -C darwin exampleinstall
-darwin_distinstall:
-	$(MAKE) -C darwin distinstall
-darwin_zipinstall:
-	$(MAKE) -C darwin zipinstall
-darwin_zipsourceinstall:
-	$(MAKE) -C darwin zipsourceinstall
-darwin_zipexampleinstall:
-	$(MAKE) -C darwin zipexampleinstall
-darwin_zipdistinstall:
-	$(MAKE) -C darwin zipdistinstall
-darwin_clean:
-	$(MAKE) -C darwin clean
-darwin_distclean:
-	$(MAKE) -C darwin distclean
-darwin_cleanall:
-	$(MAKE) -C darwin cleanall
-darwin_info:
-	$(MAKE) -C darwin info
-darwin_makefiles:
-	$(MAKE) -C darwin makefiles
-darwin:
-	$(MAKE) -C darwin all
-.PHONY: darwin_all darwin_debug darwin_smart darwin_release darwin_units darwin_examples darwin_shared darwin_install darwin_sourceinstall darwin_exampleinstall darwin_distinstall darwin_zipinstall darwin_zipsourceinstall darwin_zipexampleinstall darwin_zipdistinstall darwin_clean darwin_distclean darwin_cleanall darwin_info darwin_makefiles darwin
-endif
 ifdef TARGET_DIRS_MORPHOS
 morphos_all:
 	$(MAKE) -C morphos all

+ 2 - 1
rtl/inc/keyscan.inc

@@ -1,7 +1,8 @@
 { list of all dos scancode for key giving 0 as char }
 Const
    kbNoKey       = $00;
-   kbAltEsc      = $01;
+   kbAltEsc      = $01;  {Alt+Esc = scancode 01, ascii code 0.}
+   kbEsc         = $01;  {Esc     = scancode 01, ascii code 27.}
    kbAltSpace    = $02;
    kbCtrlIns     = $04;
    kbShiftIns    = $05;

+ 2 - 2
rtl/inc/mouse.inc

@@ -142,12 +142,12 @@ begin
     if (PendingMouseEvents>0) then
       GetPendingEvent(MouseEvent)
     else
-      FillChar(MouseEvent,sizeof(MouseEvent),0);
+      CurrentMouseDriver.GetMouseEvent(MouseEvent);
+{      FillChar(MouseEvent,sizeof(MouseEvent),0);}
     end
   else
     If Assigned(CurrentMouseDriver.GetMouseEvent) Then
       begin
-      CurrentMouseDriver.GetMouseEvent(MouseEvent);
       LastMouseEvent:=MouseEvent;
       end
     else

+ 4 - 3
rtl/inc/video.inc

@@ -79,11 +79,12 @@ end;
 Procedure AssignVideoBuf (OldCols, OldRows : Word);
 
 Var NewVideoBuf,NewOldVideoBuf : PVideoBuf;
-    S,I,C,R,NewVideoBufSize : longint;
+    I,C,R,NewVideoBufSize : longint;
+    s:word;
 
 begin
-  S:=SizeOf(TVideoCell);
-  NewVideoBufSize:=ScreenWidth*ScreenHeight*S;
+  S:=sizeOf(TVideoCell);
+  NewVideoBufSize:=ScreenWidth*ScreenHeight*s;
   GetMem(NewVideoBuf,NewVideoBufSize);
   GetMem(NewOldVideoBuf,NewVideoBufSize);
   // Move contents of old videobuffers to new if there are any.

+ 61 - 40
rtl/linux/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/06]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/13]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -263,118 +263,121 @@ override FPCOPT+=-Ur
 endif
 OBJPASDIR=$(RTL)/objpas
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt printer linuxvcs sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconsts dos objects cwstring fpcylix fpmkunit
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
@@ -412,6 +415,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 endif
@@ -526,6 +532,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconsts fpmkunit
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconsts fpmkunit
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconsts fpmkunit
 endif
@@ -640,6 +649,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override CLEAN_UNITS+=syslinux linux
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override CLEAN_UNITS+=syslinux linux
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override CLEAN_UNITS+=syslinux linux
 endif
@@ -755,6 +767,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
@@ -869,6 +884,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET) $(COMMON)
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET) $(COMMON)
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET) $(COMMON)
 endif
@@ -983,6 +1001,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_TARGETDIR+=.
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_TARGETDIR+=.
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_TARGETDIR+=.
 endif

+ 1 - 1
rtl/linux/Makefile.fpc

@@ -10,7 +10,7 @@ loaders=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 units=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil \
       heaptrc lineinfo \
       $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) \
-      crt  printer \
+      crt printer linuxvcs \
       sysutils typinfo math matrix varutils \
       charset ucomplex getopts \
       errors sockets gpm ipc serial terminfo dl dynlibs \

+ 7 - 6
rtl/linux/gpm.pp

@@ -29,7 +29,7 @@ unit gpm;
 uses
   baseUnix;
 
-{$ifndef use_external}
+{$ifdef use_external}
 {$linklib gpm}
 {$linklib c}
 {$endif}
@@ -76,17 +76,17 @@ const
 type
 {$PACKRECORDS c}
      Pgpm_event=^Tgpm_event;
-     Tgpm_event=record
+     Tgpm_event=packed record
           buttons : byte;
           modifiers : byte;
           vc : word;
           dx : word;
           dy : word;
           x,y : word;
-          wdx,wdy : word;
           EventType : TGpmEType;
           clicks : longint;
           margin : TGpmMargin;
+          wdx,wdy : word;
      end;
 
      Pgpmevent=Pgpm_event;
@@ -99,7 +99,7 @@ type
 
   type
      Pgpm_connect = ^TGpm_connect;
-     Tgpm_connect = record
+     Tgpm_connect = packed record
           eventMask : word;
           defaultMask : word;
           minMod : word;
@@ -112,7 +112,7 @@ type
      Tgpmconnect=Tgpm_connect;
 
      Pgpm_roi=^Tgpm_roi;
-     Tgpm_roi=record
+     Tgpm_roi=packed record
        xmin,xmax:integer;
        ymin,ymax:integer;
        minmod,maxmod:word;
@@ -915,7 +915,6 @@ begin
       conn.vc:=GPM_REQ_BUTTONS;
       eptr:=@event;
     end;
-
   if gpm_fd=-1 then
     begin
       gpm_getsnapshot:=-1;
@@ -935,6 +934,8 @@ begin
       else
         begin
           gpm_getsnapshot:=eptr^.eventtype; { number of buttons }
+          if eptr^.eventtype=0 then
+            gpm_getsnapshot:=15;
           eptr^.eventtype:=0;
         end;
     end;

+ 129 - 0
rtl/linux/linuxvcs.pp

@@ -0,0 +1,129 @@
+unit linuxvcs;
+
+{*****************************************************************************}
+                                   interface
+{*****************************************************************************}
+
+const vcs_device:shortint=-1;
+
+function try_grab_vcsa:boolean;
+
+{*****************************************************************************}
+                                 implementation
+{*****************************************************************************}
+
+uses baseunix,strings;
+
+function try_grab_vcsa_in_path(path:Pchar;len:cardinal):boolean;
+
+const  grab_vcsa='/grab_vcsa';
+       grab_vcsa_s:array[1..length(grab_vcsa)] of char=grab_vcsa;
+
+var p:Pchar;
+    child:Tpid;
+    status:cint;
+    pstat:stat;
+
+begin
+  getmem(p,len+length(grab_vcsa)+1);
+  move(path^,p^,len);
+  move(grab_vcsa_s,(p+len)^,length(grab_vcsa));
+  (p+len+length(grab_vcsa))^:=#0;
+  {Check if file exists.}
+  if fpstat(p,pstat)<>0 then
+    begin
+      try_grab_vcsa_in_path:=false;
+      exit;
+    end;
+  child:=fpfork;
+  if child=0 then
+    begin
+      fpexecve(p,nil,nil);
+      halt(255); {fpexec must have failed...}
+    end;
+  fpwaitpid(child,status,0);
+  try_grab_vcsa_in_path:=status=0; {Return true if success.}
+  freemem(p);
+end;
+
+
+function try_grab_vcsa:boolean;
+
+{If we cannot open /dev/vcsa0-31 it usually because we do not have
+ permission. At login the owner of the tty you login is set to yourself.
+
+ This is not done for vcsa, which is kinda strange as vcsa is revoke from
+ you when you log out. We try to call a setuid root helper which chowns
+ the vcsa device so we can get access to the screen buffer...}
+
+var path,p:Pchar;
+
+begin
+  try_grab_vcsa:=false;
+  path:=fpgetenv('PATH');
+  if path=nil then
+    exit;
+  p:=strscan(path,':');
+  while p<>nil do
+    begin
+      if try_grab_vcsa_in_path(path,p-path) then
+        begin
+          try_grab_vcsa:=true;
+          exit;
+        end;
+      path:=p+1;
+      p:=strscan(path,':');
+    end;
+  if try_grab_vcsa_in_path(path,strlen(path)) then
+    exit;
+end;
+
+
+procedure detect_linuxvcs;
+
+var f:text;
+    c:char;
+    pid,ppid,dummy:integer;
+    device:longint;
+    s:string[15];
+
+begin
+  {Extremely aggressive VCSA detection. Works even through Midnight
+   Commander. Idea from the C++ Turbo Vision project, credits go
+   to Martynas Kunigelis <[email protected]>.}
+  pid:=fpgetpid;
+  repeat
+    str(pid,s);
+    assign(f,'/proc/'+s+'/stat');
+    reset(f);
+    if ioresult<>0 then
+      break;
+    read(f,dummy);
+    read(f,c);
+    repeat
+      read(f,c);
+    until c=' ';
+    repeat
+      read(f,c);
+    until c=' ';
+    ppid:=pid;
+    read(f,pid);
+    read(f,dummy);
+    read(f,dummy);
+    read(f,device);
+    close(f);
+    if device and $ffffffc0=$00000400 then {/dev/tty*}
+      begin
+        vcs_device:=device and $3f;
+        break;
+      end;
+   until (device=0) {Not attached to a terminal, i.e. an xterm.}
+      or (pid=-1)
+      or (ppid=pid);
+end;
+
+begin
+  {Put in procedure because there are quite a bit of variables which are made
+   temporary this way.}
+  detect_linuxvcs;
+end.

+ 5 - 0
rtl/linux/powerpc/cprt0.as

@@ -80,6 +80,9 @@ main_stub:
     lis     11, ___fpc_ret@ha
     stw     1, ___fpc_ret@l(11)
 
+    lis     11, __stkptr@ha
+    stw     1, __stkptr@l(11)
+
     bl      PASCALMAIN
 
     .globl  _haltproc
@@ -108,6 +111,8 @@ ___fpc_ret:                            /* return address to libc */
     .long   0
 
 .text
+    .comm __stkptr, 4
+
     .comm operatingsystem_parameter_envp, 4
     .comm operatingsystem_parameter_argc, 4
     .comm operatingsystem_parameter_argv, 4

+ 1 - 2
rtl/linux/termio.pp

@@ -53,8 +53,7 @@ begin
     begin
       str(handle,s);
       t:='/proc/self/fd/'+s+#0;
-      fpreadlink(@t[1],@ttyname[1],255);
-      ttyname[0]:=char(strlen(@ttyname[1]));
+      ttyname[0]:=char(fpreadlink(@t[1],@ttyname[1],255));
     end;
 end;
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 399 - 254
rtl/unix/keyboard.pp


+ 18 - 6
rtl/unix/mouse.pp

@@ -48,7 +48,7 @@ const
   gpm_fs : longint = -1;
 
 {$ifndef NOGPM}
-procedure GPMEvent2MouseEvent(const e:TGPMEvent;var mouseevent:tmouseevent);
+procedure GPMEvent2MouseEvent(const e:Tgpm_event;var mouseevent:tmouseevent);
 var
   PrevButtons : byte;
 
@@ -98,7 +98,7 @@ begin
         WaitMouseMove:=false;
       end;
   else
-   MouseEvent.Action:=0;
+   MouseEvent.Action:=MouseActionMove;
   end;
 end;
 {$ENDIF}
@@ -131,7 +131,7 @@ procedure SysInitMouse;
 {$ifndef NOGPM}
 var
   connect : TGPMConnect;
-  E : TGPMEvent;
+  E : Tgpm_event;
 {$endif ndef NOGPM}
 begin
 {$ifndef NOGPM}
@@ -189,6 +189,8 @@ function SysDetectMouse:byte;
 {$ifndef NOGPM}
 var
   connect : TGPMConnect;
+  fds : tFDSet;
+  e : Tgpm_event;
 {$endif ndef NOGPM}
 begin
 {$ifndef NOGPM}
@@ -205,12 +207,22 @@ begin
           gpm_fs:=-1;
         end;
     end;
-{ always a mouse deamon present }
+  if gpm_fs>=0 then
+    begin
+      fpFD_ZERO(fds);
+      fpFD_SET(gpm_fs,fds);
+      while fpSelect(gpm_fs+1,@fds,nil,nil,1)>0 do
+        begin
+          fillchar(e,sizeof(e),#0);
+          Gpm_GetEvent(e);
+        end;
+    end;
   if gpm_fs<>-1 then
     SysDetectMouse:=Gpm_GetSnapshot(nil)
   else
     SysDetectMouse:=0;
 {$else ifdef NOGPM}
+{ always a mouse deamon present }
   if (fpgetenv('TERM')='xterm') then
     SysDetectMouse:=2;
 {$endif NOGPM}
@@ -220,7 +232,7 @@ end;
 procedure SysGetMouseEvent(var MouseEvent: TMouseEvent);
 {$ifndef NOGPM}
 var
-  e : TGPMEvent;
+  e : Tgpm_event;
 {$endif ndef NOGPM}
 begin
   fillchar(MouseEvent,SizeOf(TMouseEvent),#0);
@@ -241,7 +253,7 @@ end;
 function SysPollMouseEvent(var MouseEvent: TMouseEvent):boolean;
 {$ifndef NOGPM}
 var
-  e : TGPMEvent;
+  e : Tgpm_event;
   fds : tFDSet;
 {$endif ndef NOGPM}
 begin

+ 205 - 133
rtl/unix/video.pp

@@ -15,14 +15,20 @@
  **********************************************************************}
 unit Video;
 
-interface
+{$I-}
+
+{*****************************************************************************}
+                                   interface
+{*****************************************************************************}
 
 {$i videoh.inc}
 
-implementation
+{*****************************************************************************}
+                                implementation
+{*****************************************************************************}
 
-uses
-  BaseUnix, Strings, TermInfo, termio;
+uses  baseunix,termio,strings
+     {$ifdef linux},linuxvcs{$endif};
 
 {$i video.inc}
 
@@ -32,10 +38,127 @@ Type TConsoleType = (ttyNetwork
                      ,ttyFreeBSD
                      ,ttyNetBSD);
 
+type  Ttermcode=(
+        enter_alt_charset_mode,
+        exit_alt_charset_mode,
+        clear_screen,
+        cursor_home,
+        cursor_normal,
+        cursor_visible,
+        cursor_invisible,
+        enter_ca_mode,
+        exit_ca_mode,
+        exit_am_mode,
+        ena_acs
+      );
+      Ttermcodes=array[Ttermcode] of Pchar;
+      Ptermcodes=^Ttermcodes;
+
+const term_codes_ansi:Ttermcodes= {Linux escape sequences are equal to ansi sequences}
+        (#$1B#$5B#$31#$31#$6D,                              {enter_alt_charset_mode}
+         #$1B#$5B#$31#$30#$6D,                              {exit_alt_charset_mode}
+         #$1B#$5B#$48#$1B#$5B#$4A,                          {clear_screen}
+         #$1B#$5B#$48,                                      {cursor_home}
+         nil,                                               {cursor_normal}
+         nil,                                               {cursor_visible}
+         nil,                                               {cursor_invisible}
+         nil,                                               {enter_ca_mode}
+         nil,                                               {exit_ca_mode}
+         nil,                                               {exit_am_mode}
+         nil);                                              {ena_acs}
+
+      term_codes_freebsd:Ttermcodes=
+        (nil,                                               {enter_alt_charset_mode}
+         nil,                                               {exit_alt_charset_mode}
+         #$1B#$5B#$48#$1B#$5B#$4A,                          {clear_screen}
+         #$1B#$5B#$48,                                      {cursor_home}
+         #$1B#$5B#$3D#$30#$43,                              {cursor_normal}
+         #$1B#$5B#$3D#$31#$43,                              {cursor_visible}
+         nil,                                               {cursor_invisible}
+         nil,                                               {enter_ca_mode}
+         nil,                                               {exit_ca_mode}
+         nil,                                               {exit_am_mode}
+         nil);                                              {ena_acs}
+
+      term_codes_linux:Ttermcodes=
+        (#$1B#$5B#$31#$31#$6D,                              {enter_alt_charset_mode}
+         #$1B#$5B#$31#$30#$6D,                              {exit_alt_charset_mode}
+         #$1B#$5B#$48#$1B#$5B#$4A,                          {clear_screen}
+         #$1B#$5B#$48,                                      {cursor_home}
+         #$1B#$5B#$3F#$32#$35#$68#$1B#$5B#$3F#$30#$63,      {cursor_normal}
+         #$1B#$5B#$3F#$32#$35#$68#$1B#$5B#$3F#$30#$63,      {cursor_visible}
+         #$1B#$5B#$3F#$32#$35#$6C,                          {cursor_invisible}
+         nil,                                               {enter_ca_mode}
+         nil,                                               {exit_ca_mode}
+         nil,                                               {exit_am_mode}
+         nil);                                              {ena_acs}
+
+      term_codes_vt100:Ttermcodes=
+        (#$0E,                                              {enter_alt_charset_mode}
+         #$0F,                                              {exit_alt_charset_mode}
+         #$1B#$5B#$48#$1B#$5B#$4A#$24#$3C#$35#$30#$3E,      {clear_screen}
+         #$1B#$5B#$48,                                      {cursor_home}
+         nil,                                               {cursor_normal}
+         nil,                                               {cursor_visible}
+         nil,                                               {cursor_invisible}
+         nil,                                               {enter_ca_mode}
+         nil,                                               {exit_ca_mode}
+         #$1B#$5B#$3F#$37#$6C,                              {exit_am_mode}
+         #$1B#$28#$42#$1B#$29#$30);                         {ena_acs}
+
+      term_codes_vt220:Ttermcodes=
+        (#$1B#$28#$30#$24#$3C#$32#$3E,                      {enter_alt_charset_mode}
+         #$1B#$28#$42#$24#$3C#$34#$3E,                      {exit_alt_charset_mode}
+         #$1B#$5B#$48#$1B#$5B#$4A,                          {clear_screen}
+         #$1B#$5B#$48,                                      {cursor_home}
+         nil,                                               {cursor_normal}
+         nil,                                               {cursor_visible}
+         nil,                                               {cursor_invisible}
+         nil,                                               {enter_ca_mode}
+         nil,                                               {exit_ca_mode}
+         #$1B#$5B#$3F#$37#$6C,                              {exit_am_mode}
+         #$1B#$29#$30);                                     {ena_acs}
+
+      term_codes_xterm:Ttermcodes=
+        (#$0E,                                              {enter_alt_charset_mode}
+         #$0F,                                              {exit_alt_charset_mode}
+         #$1B#$5B#$48#$1B#$5B#$32#$4A,                      {clear_screen}
+         #$1B#$5B#$48,                                      {cursor_home}
+         #$1B#$5B#$3F#$31#$32#$6C#$1B#$5B#$3F#$32#$35#$68,  {cursor_normal}
+         #$1B#$5B#$3F#$31#$32#$3B#$32#$35#$68,              {cursor_visible}
+         #$1B#$5B#$3F#$32#$35#$6C,                          {cursor_invisible}
+         #$1B#$5B#$3F#$31#$30#$34#$39#$68,                  {enter_ca_mode}
+         #$1B#$5B#$3F#$31#$30#$34#$39#$6C,                  {exit_ca_mode}
+         #$1B#$5B#$3F#$37#$6C,                              {exit_am_mode}
+         #$1B#$28#$42#$1B#$29#$30);                         {ena_acs}
+
+
+const    terminal_names:array[0..8] of string[7]=(
+                        'ansi',
+                        'cons',
+                        'eterm',
+                        'gnome',
+                        'konsole',
+                        'linux',
+                        'vt100',
+                        'vt220',
+                        'xterm');
+         terminal_data:array[0..8] of Ptermcodes=(
+                        @term_codes_ansi,
+                        @term_codes_freebsd,
+                        @term_codes_xterm,
+                        @term_codes_xterm,
+                        @term_codes_xterm,
+                        @term_codes_linux,
+                        @term_codes_vt100,
+                        @term_codes_vt220,
+                        @term_codes_xterm);
+
 var
   LastCursorType : byte;
   TtyFd: Longint;
   Console: TConsoleType;
+  cur_term_strings:Ptermcodes;
 {$ifdef logging}
   f: file;
 
@@ -51,7 +174,7 @@ const
 
 const
 
-  can_delete_term : boolean = false;
+{  can_delete_term : boolean = false;}
   ACSIn : string = '';
   ACSOut : string = '';
   InACS : boolean =false;
@@ -147,7 +270,7 @@ begin
 end;
 
 
-function SendEscapeSeqNdx(Ndx: Word) : boolean;
+function SendEscapeSeqNdx(Ndx:Ttermcode) : boolean;
 var
   P,pdelay: PChar;
 begin
@@ -403,7 +526,7 @@ end;
     Spaces:=0;
   end;
 
-function GetTermString(ndx:word):String;
+function GetTermString(ndx:Ttermcode):String;
 var
    P,pdelay: PChar;
 begin
@@ -607,134 +730,90 @@ begin
   restoreRawSettings(preInitVideoTio);
 end;
 
-{$ifdef linux}
-function try_grab_vcsa_in_path(path:Pchar;len:cardinal):boolean;
-
-const  grab_vcsa='/grab_vcsa';
-       grab_vcsa_s:array[1..length(grab_vcsa)] of char=grab_vcsa;
-
-var p:Pchar;
-    child:Tpid;
-    status:cint;
-    pstat:stat;
-
-begin
-  getmem(p,len+length(grab_vcsa)+1);
-  move(path^,p^,len);
-  move(grab_vcsa_s,(p+len)^,length(grab_vcsa));
-  (p+len+length(grab_vcsa))^:=#0;
-  {Check if file exists.}
-  if fpstat(p,pstat)<>0 then
-    begin
-      try_grab_vcsa_in_path:=false;
-      exit;
-    end;
-  child:=fpfork;
-  if child=0 then
-    begin
-      fpexecve(p,nil,nil);
-      halt(255); {fpexec must have failed...}
-    end;
-  fpwaitpid(child,status,0);
-  try_grab_vcsa_in_path:=status=0; {Return true if success.}
-  freemem(p);
-end;
-
-function try_grab_vcsa:boolean;
-
-{If we cannot open /dev/vcsa0-31 it usually because we do not have
- permission. At login the owner of the tty you login is set to yourself.
-
- This is not done for vcsa, which is kinda strange as vcsa is revoke from
- you when you log out. We try to call a setuid root helper which chowns
- the vcsa device so we can get access to the screen buffer...}
-
-var path,p:Pchar;
-
-begin
-  try_grab_vcsa:=false;
-  path:=fpgetenv('PATH');
-  if path=nil then
-    exit;
-  p:=strscan(path,':');
-  while p<>nil do
-    begin
-      if try_grab_vcsa_in_path(path,p-path) then
-        begin
-          try_grab_vcsa:=true;
-          exit;
-        end;
-      path:=p+1;
-      p:=strscan(path,':');
-    end;
-  if try_grab_vcsa_in_path(path,strlen(path)) then
-    exit;
-end;
-{$endif}
-
 procedure SysInitVideo;
-const
-  fontstr : string[3]=#27'(K';
 var
-  ThisTTY: String[30];
   FName: String;
   WS: packed record
     ws_row, ws_col, ws_xpixel, ws_ypixel: Word;
   end;
-  Err: Longint;
-  prev_term : TerminalCommon_ptr1;
+{  Err: Longint;}
+{  prev_term : TerminalCommon_ptr1;}
+  term:string;
+  i:word;
+{$ifdef Linux}
+  s:string[15];
+{$endif}
+{$ifdef freebsd}
+  ThisTTY: String[30];
+{$endif}
+
+const font_vga:array[0..6] of char=#15#27'%@'#27'(U';
+      font_custom:array[0..2] of char=#27'(K';
+
 begin
 {$ifndef CPUI386}
   LowAscii:=false;
 {$endif CPUI386}
   { check for tty }
-  ThisTTY:=TTYName(stdinputhandle);
   if (IsATTY(stdinputhandle)=1) then
    begin
      { save current terminal characteristics and remove rawness }
      prepareInitVideo;
-     { write code to set a correct font }
-     fpWrite(stdoutputhandle,fontstr[1],length(fontstr));
      { running on a tty, find out whether locally or remotely }
      TTyfd:=-1;
-     Console:=TTyNetwork;  {Default: Network or other vtxxx tty}
-     if (Copy(ThisTTY, 1, 8) = '/dev/tty') and
-        not (ThisTTY[9] IN ['p'..'u','P']) then                 // FreeBSD has these
-      begin
-        { running on the console }
-        Case ThisTTY[9] of
-        {$ifdef linux}
-         '0'..'9' : begin { running Linux on native console or native-emulation }
-                     FName:='/dev/vcsa' + ThisTTY[9];
-                     { open console, $1b6=rw-rw-rw- }
-                     TTYFd:=fpOpen(FName, $1b6, O_RdWr);
-                     if TTYFd<>-1 Then
-                       console:=ttyLinux
-                     else
-                       if try_grab_vcsa then
-                         begin
-                           TTYFd:=fpOpen(FName, $1b6, O_RdWr);
-                           if TTYFd<>-1 Then
-                             console:=Ttylinux;
-                         end;
-                    end;
-        {$endif}
-         'v'  :  { check for (Free?)BSD native}
-                If (ThisTTY[10]>='0') and (ThisTTY[10]<='9') Then
-                 Console:=ttyFreeBSD;   {TTYFd ?}
-         end;
-       end;
-     If (Copy(fpGetEnv('TERM'),1,4)='cons') Then                // cons<lines>
-       Console:=ttyFreeBSD;
+     Console:=TTyNetwork;                 {Default: Network or other vtxxx tty}
+     cur_term_strings:=@term_codes_vt100; {Default: vt100}
    {$ifdef linux}
-     If Console<>ttylinux Then
+     if vcs_device>=0 then
+       begin
+         str(vcs_device,s);
+         fname:='/dev/vcsa'+s;
+         { open console, $1b6=rw-rw-rw- }
+         ttyfd:=fpopen(fname,$1b6,O_RDWR);
+         if ttyfd<>-1 then
+           console:=ttylinux
+         else
+           if try_grab_vcsa then
+             begin
+               ttyfd:=fpopen(fname,$1b6,O_RDWR);
+               if ttyfd<>-1 then
+                 console:=ttylinux;
+             end;
+       end;
+   {$endif}
+   {$ifdef freebsd}
+     ThisTTY:=TTYName(stdinputhandle);
+     if copy(ThisTTY, 1, 9) = '/dev/ttyv' then  {FreeBSD has these}
+       begin
+         { check for (Free?)BSD native}
+         if (ThisTTY[10]>='0') and (ThisTTY[10]<='9') Then
+            Console:=ttyFreeBSD;   {TTYFd ?}
+       end;
+   {$endif}
+     term:=fpgetenv('TERM');
+     for i:=low(terminal_names) to high(terminal_names) do
+       if copy(term,1,length(terminal_names[i]))=terminal_names[i] then
+         cur_term_strings:=terminal_data[i];
+    if cur_term_strings=@term_codes_freebsd then
+      console:=ttyFreeBSD;
+{$ifdef linux}
+    if (console<>ttylinux) then
       begin
+{$endif}
+        if cur_term_strings=@term_codes_linux then
+          begin
+            {Executed in case ttylinux is false (i.e. no vcsa), but
+             TERM=linux.}
+            {Enable the VGA character set (codepage 437,850,....)}
+            fpwrite(stdoutputhandle,font_vga,7);
+          end
+        else
+          {No VGA font :( }
+          fpwrite(stdoutputhandle,font_custom,3);
         { running on a remote terminal, no error with /dev/vcsa }
         LowAscii:=false;
-        //TTYFd:=stdoutputhandle;
+   {$ifdef linux}
       end;
-   {$else}
-     lowascii:=false;
    {$endif}
      fpioctl(stdinputhandle, TIOCGWINSZ, @WS);
      if WS.ws_Col=0 then
@@ -756,9 +835,6 @@ begin
      if Console<>ttylinux then
       begin
    {$endif}
-        prev_term:=cur_term;
-        setupterm(nil, stdoutputhandle, err);
-        can_delete_term:=assigned(prev_term) and (prev_term<>cur_term);
         SendEscapeSeqNdx(cursor_home);
         SendEscapeSeqNdx(cursor_normal);
         SendEscapeSeqNdx(cursor_visible);
@@ -767,17 +843,12 @@ begin
         If Console=ttyFreeBSD Then
           SendEscapeSeqNdx(exit_am_mode);
    {$ifdef linux}
-      end
-     else if not assigned(cur_term) then
-       begin
-         setupterm(nil, stdoutputhandle, err);
-         can_delete_term:=false;
-       end;
+      end;
    {$endif}
      if assigned(cur_term_Strings) then
        begin
-         ACSIn:=StrPas(cur_term_Strings^[enter_alt_charset_mode]);
-         ACSOut:=StrPas(cur_term_Strings^[exit_alt_charset_mode]);
+         ACSIn:=StrPas(cur_term_strings^[enter_alt_charset_mode]);
+         ACSOut:=StrPas(cur_term_strings^[exit_alt_charset_mode]);
          if (ACSIn<>'') and (ACSOut<>'') then
            SendEscapeSeqNdx(ena_acs);
          if pos('$<',ACSIn)>0 then
@@ -804,6 +875,9 @@ begin
 end;
 
 procedure SysDoneVideo;
+
+var font_custom:array[0..2] of char=#27'(K';
+
 begin
   prepareDoneVideo;
 {$ifdef linux}
@@ -818,21 +892,19 @@ begin
      SendEscapeSeqNdx(cursor_visible);
      SetCursorType(crUnderLine);
      SendEscapeSeq(#27'[H');
+     if cur_term_strings=@term_codes_linux then
+       begin
+         {Executed in case ttylinux is false (i.e. no vcsa), but
+          TERM=linux.}
+         {Enable the character set set through setfont}
+         fpwrite(stdoutputhandle,font_custom,3);
+       end;
 {$ifdef linux}
    end;
 {$endif}
   ACSIn:='';
   ACSOut:='';
   doneVideoDone;
-  { FreeBSD gives an error here.
-   According to Pierre this could be more a NCurses version thing that
-   a FreeBSD one. FreeBSD 4.4 has ncurses 5.
-   MvdV102003: Since I ran 1.1 with newer FreeBSD without problem, I let it be for now}
-  if can_delete_term then
-    begin
-      del_curterm(cur_term);
-      can_delete_term:=false;
-    end;
 {$ifdef logging}
   close(f);
 {$endif logging}

+ 43 - 8
utils/grab_vcsa.pp

@@ -1,5 +1,7 @@
 program grab_vcsa;
 
+{$I-}
+
 {
     This file is part of the Free Pascal run time library.
     Copyright (c) 2005 by Daniël Mantione
@@ -59,26 +61,59 @@ const   result_success=0;
         result_not_owner_error=5;
 
 var thistty:string;
-    vcs,vcsa:string;
+    tty,vcs,vcsa:string;
     ttystat:stat;
+    s:string[15];
+    c:char;
+    ppid,pid,parent,dummy:integer;
+    device:longint;
+    f:text;
+    found_vcsa:boolean;
 
 begin
   exitcode:=result_not_on_console;
   thistty:=ttyname(stdinputhandle);
   if isatty(stdinputhandle)=1 then
     begin
-      { running on a tty, find out whether locally or remotely }
-      if (length(thistty)>=9) and
-         (copy(thistty,1,8)='/dev/tty') and
-         (thistty[9] in ['0'..'9']) then
+      pid:=fpgetpid;
+      repeat
+        str(pid,s);
+        assign(f,'/proc/'+s+'/stat');
+        reset(f);
+        if ioresult<>0 then
+          begin
+            found_vcsa:=false;
+            break;
+          end;
+        read(f,dummy);
+        read(f,c);
+        repeat
+          read(f,c);
+        until c=' ';
+        repeat
+          read(f,c);
+        until c=' ';
+        ppid:=pid;
+        read(f,pid);
+        read(f,dummy);
+        read(f,dummy);
+        read(f,device);
+        close(f);
+        found_vcsa:=device and $ffffffc0=$00000400; {/dev/tty*}
+        if (device=0) or (pid=-1) or (ppid=pid) then
+          break; {Not attached to a terminal, i.e. an xterm.}
+      until found_vcsa;
+      if found_vcsa then
         begin
           {We are running on the Linux console}
-          if fpstat(thistty,ttystat)<>0 then
+          str(device and $0000003f,s);
+          tty:='/dev/tty'+s;
+          if fpstat(tty,ttystat)<>0 then
             halt(result_stat_error);
           if ttystat.uid<>fpgetuid then
             halt(result_not_owner_error);
-          vcs:='/dev/vcs'+copy(thistty,9,255);
-          vcsa:='/dev/vcsa'+copy(thistty,9,255);
+          vcs:='/dev/vcs'+s;
+          vcsa:='/dev/vcsa'+s;
           
           {Change owner and group to that of /dev/tty??.}
           if fpchown(vcs,ttystat.uid,ttystat.gid)<>0 then

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov