mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 03:29:19 +02:00
* Optimization for code size.
git-svn-id: trunk@5331 -
This commit is contained in:
parent
21bd30b47c
commit
4bfe0e6819
@ -671,6 +671,7 @@ Procedure FinalizeHeap;forward;
|
|||||||
Procedure InternalExit;
|
Procedure InternalExit;
|
||||||
var
|
var
|
||||||
current_exit : Procedure;
|
current_exit : Procedure;
|
||||||
|
pstdout : ^Text;
|
||||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||||
i : longint;
|
i : longint;
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -688,18 +689,19 @@ Begin
|
|||||||
{ Finalize units }
|
{ Finalize units }
|
||||||
FinalizeUnits;
|
FinalizeUnits;
|
||||||
{ Show runtime error and exit }
|
{ Show runtime error and exit }
|
||||||
|
pstdout:=@stdout;
|
||||||
If erroraddr<>nil Then
|
If erroraddr<>nil Then
|
||||||
Begin
|
Begin
|
||||||
Writeln(stdout,'Runtime error ',Errorcode,' at $',hexstr(PtrInt(Erroraddr),sizeof(PtrInt)*2));
|
Writeln(pstdout^,'Runtime error ',Errorcode,' at $',hexstr(PtrInt(Erroraddr),sizeof(PtrInt)*2));
|
||||||
{ to get a nice symify }
|
{ to get a nice symify }
|
||||||
Writeln(stdout,BackTraceStrFunc(Erroraddr));
|
Writeln(pstdout^,BackTraceStrFunc(Erroraddr));
|
||||||
dump_stack(stdout,ErrorBase);
|
dump_stack(pstdout^,ErrorBase);
|
||||||
Writeln(stdout,'');
|
Writeln(pstdout^,'');
|
||||||
End;
|
End;
|
||||||
{ Make sure that all output is written to the redirected file }
|
{ Make sure that all output is written to the redirected file }
|
||||||
Flush(Output);
|
Flush(Output);
|
||||||
Flush(ErrOutput);
|
Flush(ErrOutput);
|
||||||
Flush(StdOut);
|
Flush(pstdout^);
|
||||||
Flush(StdErr);
|
Flush(StdErr);
|
||||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||||
{ finally release the heap if possible, especially
|
{ finally release the heap if possible, especially
|
||||||
|
@ -279,28 +279,33 @@ threadvar
|
|||||||
|
|
||||||
|
|
||||||
Procedure Errno2InOutRes;
|
Procedure Errno2InOutRes;
|
||||||
|
var
|
||||||
|
res : Word;
|
||||||
|
pErrno : ^longint;
|
||||||
Begin
|
Begin
|
||||||
{ DO NOT MODIFY UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING }
|
{ DO NOT MODIFY UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING }
|
||||||
case Errno of
|
pErrno:=@Errno;
|
||||||
|
case pErrno^ of
|
||||||
ERROR_WRITE_PROTECT..ERROR_GEN_FAILURE :
|
ERROR_WRITE_PROTECT..ERROR_GEN_FAILURE :
|
||||||
begin
|
begin
|
||||||
{ This is the offset to the Win32 to add to directly map }
|
{ This is the offset to the Win32 to add to directly map }
|
||||||
{ to the DOS/TP compatible error codes when in this range }
|
{ to the DOS/TP compatible error codes when in this range }
|
||||||
InOutRes := word(errno)+131;
|
res := word(pErrno^)+131;
|
||||||
end;
|
end;
|
||||||
ERROR_DIR_NOT_EMPTY,
|
ERROR_DIR_NOT_EMPTY,
|
||||||
ERROR_ALREADY_EXISTS,
|
ERROR_ALREADY_EXISTS,
|
||||||
ERROR_SHARING_VIOLATION :
|
ERROR_SHARING_VIOLATION :
|
||||||
begin
|
begin
|
||||||
InOutRes :=5;
|
res :=5;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ other error codes can directly be mapped }
|
{ other error codes can directly be mapped }
|
||||||
InOutRes := Word(errno);
|
res := Word(pErrno^);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
errno:=0;
|
pErrno^:=0;
|
||||||
|
InOutRes:=res;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user