mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 13:06:18 +02:00
* merged fixes from 1.0
This commit is contained in:
parent
74f6abf381
commit
a2be264e11
@ -285,6 +285,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (gpm_fs=-2) or (Select(gpm_fs+1,@fds,nil,nil,1)>0) then
|
if (gpm_fs=-2) or (Select(gpm_fs+1,@fds,nil,nil,1)>0) then
|
||||||
begin
|
begin
|
||||||
|
FillChar(e,SizeOf(e),#0);
|
||||||
Gpm_GetSnapshot(e);
|
Gpm_GetSnapshot(e);
|
||||||
if e.x>0 then
|
if e.x>0 then
|
||||||
MouseEvent.x:=e.x-1
|
MouseEvent.x:=e.x-1
|
||||||
@ -309,7 +310,7 @@ begin
|
|||||||
else
|
else
|
||||||
MouseEvent.Action:=0;
|
MouseEvent.Action:=0;
|
||||||
end;
|
end;
|
||||||
if (gpm_fs<>-2) or (MouseEvent.Action<>0) then
|
if {(gpm_fs<>-2) or} (MouseEvent.Action<>0) then
|
||||||
SysPollMouseEvent:=true
|
SysPollMouseEvent:=true
|
||||||
else
|
else
|
||||||
SysPollMouseEvent:=false;
|
SysPollMouseEvent:=false;
|
||||||
@ -356,14 +357,17 @@ Const
|
|||||||
);
|
);
|
||||||
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
SetMouseDriver(SysMouseDriver);
|
SetMouseDriver(SysMouseDriver);
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2001-09-22 00:01:43 michael
|
Revision 1.6 2001-12-02 17:21:25 peter
|
||||||
|
* merged fixes from 1.0
|
||||||
|
|
||||||
|
Revision 1.5 2001/09/22 00:01:43 michael
|
||||||
+ Merged driver support for mouse from fixbranch
|
+ Merged driver support for mouse from fixbranch
|
||||||
|
|
||||||
Revision 1.4 2001/09/17 21:36:31 peter
|
Revision 1.4 2001/09/17 21:36:31 peter
|
||||||
|
@ -161,25 +161,78 @@ var
|
|||||||
|
|
||||||
const
|
const
|
||||||
fpucw : word = $1332;
|
fpucw : word = $1332;
|
||||||
|
Exception_handler_installed : boolean = false;
|
||||||
|
MAX_Level = 16;
|
||||||
|
except_level : byte = 0;
|
||||||
|
var
|
||||||
|
except_eip : array[0..Max_level-1] of longint;
|
||||||
|
except_signal : array[0..Max_level-1] of longint;
|
||||||
|
reset_fpu : array[0..max_level-1] of boolean;
|
||||||
|
|
||||||
|
|
||||||
|
procedure JumpToHandleSignal;
|
||||||
|
var
|
||||||
|
res, eip, ebp, sigtype : longint;
|
||||||
|
begin
|
||||||
|
asm
|
||||||
|
pushal
|
||||||
|
movl (%ebp),%eax
|
||||||
|
movl %eax,ebp
|
||||||
|
end;
|
||||||
|
if except_level>0 then
|
||||||
|
dec(except_level)
|
||||||
|
else
|
||||||
|
exit;
|
||||||
|
eip:=except_eip[except_level];
|
||||||
|
|
||||||
|
sigtype:=except_signal[except_level];
|
||||||
|
if reset_fpu[except_level] then
|
||||||
|
asm
|
||||||
|
fninit
|
||||||
|
fldcw fpucw
|
||||||
|
end;
|
||||||
|
if (sigtype>=SIGABRT) and (sigtype<=SIGMAX) and
|
||||||
|
(signal_list[sigtype]<>@SIG_DFL) then
|
||||||
|
begin
|
||||||
|
res:=signal_list[sigtype](sigtype);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
res:=0;
|
||||||
|
|
||||||
|
if res=0 then
|
||||||
|
RunError(sigtype)
|
||||||
|
else
|
||||||
|
{ jump back to old code }
|
||||||
|
asm
|
||||||
|
popal
|
||||||
|
movl eip,%eax
|
||||||
|
movl %eax,4(%ebp)
|
||||||
|
ret
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Signals_exception_handler(excep :PEXCEPTION_POINTERS) : longint;stdcall;
|
function Signals_exception_handler(excep :PEXCEPTION_POINTERS) : longint;stdcall;
|
||||||
var frame,res : longint;
|
var frame,res : longint;
|
||||||
function CallSignal(error,frame : longint;must_reset_fpu : boolean) : longint;
|
function CallSignal(sigtype,frame : longint;must_reset_fpu : boolean) : longint;
|
||||||
begin
|
begin
|
||||||
CallSignal:=Exception_Continue_Search;
|
if frame=0 then
|
||||||
{$ifdef i386}
|
CallSignal:=Exception_Continue_Search
|
||||||
if must_reset_fpu then
|
else
|
||||||
asm
|
begin
|
||||||
fninit
|
if except_level >= Max_level then
|
||||||
fldcw fpucw
|
exit;
|
||||||
|
except_eip[except_level]:=excep^.ContextRecord^.Eip;
|
||||||
|
except_signal[except_level]:=sigtype;
|
||||||
|
reset_fpu[except_level]:=must_reset_fpu;
|
||||||
|
inc(except_level);
|
||||||
|
dec(excep^.ContextRecord^.Esp,4);
|
||||||
|
plongint (excep^.ContextRecord^.Esp)^ := excep^.ContextRecord^.Eip;
|
||||||
|
excep^.ContextRecord^.Eip:=longint(@JumpToHandleSignal);
|
||||||
|
CallSignal:=Exception_Continue_Execution;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
{$endif i386}
|
|
||||||
if (error>=SIGABRT) and (error<=SIGMAX) and (signal_list[error]<>@SIG_DFL) then
|
|
||||||
res:=signal_list[error](error);
|
|
||||||
if res>=0 then
|
|
||||||
CallSignal:=Exception_Continue_Execution;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -256,6 +309,8 @@ const
|
|||||||
oldexceptaddr,newexceptaddr : longint;
|
oldexceptaddr,newexceptaddr : longint;
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SYSTEMEXCEPTIONDEBUG}
|
||||||
begin
|
begin
|
||||||
|
if Exception_handler_installed then
|
||||||
|
exit;
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
||||||
asm
|
asm
|
||||||
movl $0,%eax
|
movl $0,%eax
|
||||||
@ -274,10 +329,13 @@ const
|
|||||||
writeln(stderr,'Old exception ',hexstr(oldexceptaddr,8),
|
writeln(stderr,'Old exception ',hexstr(oldexceptaddr,8),
|
||||||
' new exception ',hexstr(newexceptaddr,8));
|
' new exception ',hexstr(newexceptaddr,8));
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SYSTEMEXCEPTIONDEBUG}
|
||||||
|
Exception_handler_installed := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure remove_exception_handler;
|
procedure remove_exception_handler;
|
||||||
begin
|
begin
|
||||||
|
if not Exception_handler_installed then
|
||||||
|
exit;
|
||||||
SetUnhandledExceptionFilter(nil);
|
SetUnhandledExceptionFilter(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -308,6 +366,8 @@ begin
|
|||||||
signal:=@SIG_ERR;
|
signal:=@SIG_ERR;
|
||||||
runerror(201);
|
runerror(201);
|
||||||
end;
|
end;
|
||||||
|
if not Exception_handler_installed then
|
||||||
|
install_exception_handler;
|
||||||
temp := signal_list[sig];
|
temp := signal_list[sig];
|
||||||
signal_list[sig] := func;
|
signal_list[sig] := func;
|
||||||
signal:=temp;
|
signal:=temp;
|
||||||
@ -328,9 +388,12 @@ initialization
|
|||||||
|
|
||||||
for i:=SIGABRT to SIGMAX do
|
for i:=SIGABRT to SIGMAX do
|
||||||
signal_list[i]:=@SIG_DFL;
|
signal_list[i]:=@SIG_DFL;
|
||||||
install_exception_handler;
|
|
||||||
|
{ install_exception_handler;
|
||||||
|
delay this to first use
|
||||||
|
as other units also might install their handlers PM }
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
|
|
||||||
remove_exception_handler;
|
remove_exception_handler;
|
||||||
end.
|
end.
|
||||||
|
@ -117,6 +117,7 @@ const
|
|||||||
Dll_Thread_Attach_Hook : TDLL_Entry_Hook = nil;
|
Dll_Thread_Attach_Hook : TDLL_Entry_Hook = nil;
|
||||||
Dll_Thread_Detach_Hook : TDLL_Entry_Hook = nil;
|
Dll_Thread_Detach_Hook : TDLL_Entry_Hook = nil;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ include system independent routines }
|
{ include system independent routines }
|
||||||
@ -339,7 +340,7 @@ end;
|
|||||||
function GetFileSize(h:longint;p:pointer) : longint;
|
function GetFileSize(h:longint;p:pointer) : longint;
|
||||||
external 'kernel32' name 'GetFileSize';
|
external 'kernel32' name 'GetFileSize';
|
||||||
function CreateFile(name : pointer;access,sharing : longint;
|
function CreateFile(name : pointer;access,sharing : longint;
|
||||||
security : pointer;how,attr,template : longint) : longint;
|
security : PSecurityAttributes;how,attr,template : longint) : longint;
|
||||||
external 'kernel32' name 'CreateFileA';
|
external 'kernel32' name 'CreateFileA';
|
||||||
function SetEndOfFile(h : longint) : longbool;
|
function SetEndOfFile(h : longint) : longbool;
|
||||||
external 'kernel32' name 'SetEndOfFile';
|
external 'kernel32' name 'SetEndOfFile';
|
||||||
@ -490,6 +491,7 @@ Const
|
|||||||
Var
|
Var
|
||||||
shflags,
|
shflags,
|
||||||
oflags,cd : longint;
|
oflags,cd : longint;
|
||||||
|
security : TSecurityAttributes;
|
||||||
begin
|
begin
|
||||||
AllowSlash(p);
|
AllowSlash(p);
|
||||||
{ close first if opened }
|
{ close first if opened }
|
||||||
@ -559,7 +561,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
filerec(f).handle:=CreateFile(p,oflags,shflags,nil,cd,FILE_ATTRIBUTE_NORMAL,0);
|
security.nLength := Sizeof(TSecurityAttributes);
|
||||||
|
security.bInheritHandle:=true;
|
||||||
|
security.lpSecurityDescriptor:=nil;
|
||||||
|
filerec(f).handle:=CreateFile(p,oflags,shflags,@security,cd,FILE_ATTRIBUTE_NORMAL,0);
|
||||||
{ append mode }
|
{ append mode }
|
||||||
if (flags and $100)<>0 then
|
if (flags and $100)<>0 then
|
||||||
begin
|
begin
|
||||||
@ -1562,7 +1567,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2001-11-08 16:16:54 florian
|
Revision 1.22 2001-12-02 17:21:25 peter
|
||||||
|
* merged fixes from 1.0
|
||||||
|
|
||||||
|
Revision 1.21 2001/11/08 16:16:54 florian
|
||||||
+ beginning of variant dispatching
|
+ beginning of variant dispatching
|
||||||
|
|
||||||
Revision 1.20 2001/11/07 13:05:16 michael
|
Revision 1.20 2001/11/07 13:05:16 michael
|
||||||
|
@ -85,10 +85,10 @@ type
|
|||||||
PLPWSTR = ^LPWSTR;
|
PLPWSTR = ^LPWSTR;
|
||||||
|
|
||||||
PSecurityAttributes = ^TSecurityAttributes;
|
PSecurityAttributes = ^TSecurityAttributes;
|
||||||
TSecurityAttributes = record
|
TSecurityAttributes = packed record
|
||||||
nLength : DWORD;
|
nLength : DWORD;
|
||||||
lpSecurityDescriptor : Pointer;
|
lpSecurityDescriptor : Pointer;
|
||||||
bInheritHandle : Boolean;
|
bInheritHandle : BOOL;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PProcessInformation = ^TProcessInformation;
|
PProcessInformation = ^TProcessInformation;
|
||||||
@ -120,7 +120,10 @@ type
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2001-07-30 14:53:17 marco
|
Revision 1.7 2001-12-02 17:21:25 peter
|
||||||
|
* merged fixes from 1.0
|
||||||
|
|
||||||
|
Revision 1.6 2001/07/30 14:53:17 marco
|
||||||
* whcar now in system.
|
* whcar now in system.
|
||||||
|
|
||||||
Revision 1.5 2001/05/02 10:25:23 marco
|
Revision 1.5 2001/05/02 10:25:23 marco
|
||||||
@ -135,5 +138,5 @@ type
|
|||||||
|
|
||||||
Revision 1.2 2000/07/13 11:33:58 michael
|
Revision 1.2 2000/07/13 11:33:58 michael
|
||||||
+ removed logs
|
+ removed logs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user