mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 01:50:38 +01:00
+ io-error 103 added
This commit is contained in:
parent
67d932c449
commit
97bbe41037
@ -86,6 +86,7 @@ type
|
||||
var
|
||||
stub_info : p_stub_info;
|
||||
go32_info_block : t_go32_info_block;
|
||||
LFNSupport : boolean;
|
||||
|
||||
{ Needed for CRT unit }
|
||||
function do_read(h,addr,len : longint) : longint;
|
||||
@ -138,7 +139,6 @@ begin
|
||||
end['EAX','EBX'];
|
||||
HandleError(202);
|
||||
end;
|
||||
{$I386_ATT}
|
||||
|
||||
procedure halt(errnum : byte);
|
||||
begin
|
||||
@ -227,6 +227,9 @@ asm
|
||||
pushl %ebp
|
||||
intl $0x21
|
||||
popl %ebp
|
||||
jnc .LCLOSE1
|
||||
movw %ax,inoutres
|
||||
.LCLOSE1:
|
||||
end;
|
||||
|
||||
|
||||
@ -609,7 +612,10 @@ Begin
|
||||
End.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 1998-11-16 14:15:01 pierre
|
||||
Revision 1.11 1998-11-29 22:28:09 peter
|
||||
+ io-error 103 added
|
||||
|
||||
Revision 1.10 1998/11/16 14:15:01 pierre
|
||||
* changed getdir(byte,string) to getdir(byte,shortstring)
|
||||
|
||||
Revision 1.9 1998/09/14 10:48:03 peter
|
||||
|
||||
@ -721,6 +721,8 @@ begin
|
||||
{$endif SYSTEMDEBUG}
|
||||
regs.realeax:=$3e00;
|
||||
sysrealintr($21,regs);
|
||||
if (regs.realflags and carryflag) <> 0 then
|
||||
InOutRes:=lo(regs.realeax);
|
||||
end;
|
||||
|
||||
|
||||
@ -1225,7 +1227,10 @@ Begin
|
||||
End.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 1998-11-16 14:15:02 pierre
|
||||
Revision 1.24 1998-11-29 22:28:10 peter
|
||||
+ io-error 103 added
|
||||
|
||||
Revision 1.23 1998/11/16 14:15:02 pierre
|
||||
* changed getdir(byte,string) to getdir(byte,shortstring)
|
||||
|
||||
Revision 1.22 1998/10/26 14:49:46 pierre
|
||||
|
||||
131
rtl/inc/file.inc
131
rtl/inc/file.inc
@ -56,6 +56,15 @@ Procedure Rewrite(var f:File;l:Longint);[IOCheck];
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
Case FileRec(f).mode Of
|
||||
fmInOut : Close(f);
|
||||
fmClosed : ;
|
||||
else
|
||||
Begin
|
||||
InOutRes:=102;
|
||||
exit;
|
||||
End;
|
||||
End;
|
||||
If l=0 Then
|
||||
InOutRes:=2
|
||||
else
|
||||
@ -73,6 +82,15 @@ Procedure Reset(var f:File;l:Longint);[IOCheck];
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
Exit;
|
||||
Case FileRec(f).mode Of
|
||||
fmInOut : Close(f);
|
||||
fmClosed : ;
|
||||
else
|
||||
Begin
|
||||
InOutRes:=102;
|
||||
exit;
|
||||
End;
|
||||
End;
|
||||
If l=0 Then
|
||||
InOutRes:=2
|
||||
else
|
||||
@ -110,7 +128,14 @@ Procedure BlockWrite(Var f:File;Var Buf;Count:Longint;var Result:Longint);[IOChe
|
||||
Write Count records from Buf to file f, return written records in result
|
||||
}
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
Result:=0;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
Result:=Do_Write(FileRec(f).Handle,Longint(@Buf),Count*FileRec(f).RecSize) div FileRec(f).RecSize;
|
||||
End;
|
||||
|
||||
@ -122,8 +147,6 @@ Procedure BlockWrite(Var f:File;Var Buf;Count:Word;var Result:Word);[IOCheck];
|
||||
var
|
||||
l : longint;
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
BlockWrite(f,Buf,Count,l);
|
||||
Result:=l;
|
||||
End;
|
||||
@ -136,8 +159,6 @@ Procedure BlockWrite(Var f:File;Var Buf;Count:Word;var Result:Integer);[IOCheck]
|
||||
var
|
||||
l : longint;
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
BlockWrite(f,Buf,Count,l);
|
||||
Result:=l;
|
||||
End;
|
||||
@ -151,8 +172,6 @@ Procedure BlockWrite(Var f:File;Var Buf;Count:Longint);[IOCheck];
|
||||
var
|
||||
Result : Longint;
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
BlockWrite(f,Buf,Count,Result);
|
||||
If (Result=0) and (Count>0) Then
|
||||
InOutRes:=101;
|
||||
@ -165,9 +184,12 @@ Procedure BlockRead(var f:File;var Buf;Count:Longint;var Result:Longint);[IOChec
|
||||
Result
|
||||
}
|
||||
Begin
|
||||
Result:=0;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
Result:=0;
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
Result:=Do_Read(FileRec(f).Handle,Longint(@Buf),count*FileRec(f).RecSize) div FileRec(f).RecSize;
|
||||
@ -182,11 +204,6 @@ Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Word);[IOCheck];
|
||||
var
|
||||
l : longint;
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
begin
|
||||
Result:=0;
|
||||
exit;
|
||||
end;
|
||||
BlockRead(f,Buf,Count,l);
|
||||
Result:=l;
|
||||
End;
|
||||
@ -200,11 +217,6 @@ Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Integer);[IOCheck];
|
||||
var
|
||||
l : longint;
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
begin
|
||||
Result:=0;
|
||||
exit;
|
||||
end;
|
||||
BlockRead(f,Buf,Count,l);
|
||||
Result:=l;
|
||||
End;
|
||||
@ -218,8 +230,6 @@ Procedure BlockRead(Var f:File;Var Buf;Count:Longint);[IOCheck];
|
||||
var
|
||||
Result : Longint;
|
||||
Begin
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
BlockRead(f,Buf,Count,Result);
|
||||
If (Result=0) and (Count>0) Then
|
||||
InOutRes:=100;
|
||||
@ -231,10 +241,15 @@ Function FilePos(var f:File):Longint;[IOCheck];
|
||||
Return current Position In file f in records
|
||||
}
|
||||
Begin
|
||||
FilePos:=0;
|
||||
If InOutRes <> 0 then
|
||||
FilePos:=0
|
||||
else
|
||||
FilePos:=Do_FilePos(FileRec(f).Handle) div FileRec(f).RecSize;
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
FilePos:=Do_FilePos(FileRec(f).Handle) div FileRec(f).RecSize;
|
||||
End;
|
||||
|
||||
|
||||
@ -243,9 +258,15 @@ Function FileSize(var f:File):Longint;[IOCheck];
|
||||
Return the size of file f in records
|
||||
}
|
||||
Begin
|
||||
if (InOutRes<>0) or (FileRec(f).RecSize=0) then
|
||||
FileSize:=0
|
||||
else
|
||||
FileSize:=0;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
if (FileRec(f).RecSize>0) then
|
||||
FileSize:=Do_FileSize(FileRec(f).Handle) div FileRec(f).RecSize;
|
||||
End;
|
||||
|
||||
@ -255,7 +276,14 @@ Function Eof(var f:File):Boolean;[IOCheck];
|
||||
Return True if we're at the end of the file f, else False is returned
|
||||
}
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
Eof:=false;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
{Can't use do_ routines because we need record support}
|
||||
Eof:=(FileSize(f)<=FilePos(f));
|
||||
End;
|
||||
@ -266,7 +294,13 @@ Procedure Seek(var f:File;Pos:Longint);[IOCheck];
|
||||
Goto record Pos in file f
|
||||
}
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
Do_Seek(FileRec(f).Handle,Pos*FileRec(f).RecSize);
|
||||
End;
|
||||
|
||||
@ -276,7 +310,13 @@ Procedure Truncate(Var f:File);[IOCheck];
|
||||
Truncate/Cut file f at the current record Position
|
||||
}
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
Do_Truncate(FileRec(f).Handle,FilePos(f)*FileRec(f).RecSize);
|
||||
End;
|
||||
|
||||
@ -286,18 +326,23 @@ Procedure Close(var f:File);[IOCheck];
|
||||
Close file f
|
||||
}
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If (FileRec(f).mode<>fmClosed) Then
|
||||
Begin
|
||||
FileRec(f).mode:=fmClosed;
|
||||
Do_Close(FileRec(f).Handle);
|
||||
End;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
if FileRec(f).Mode<>fmInOut then
|
||||
begin
|
||||
InOutRes:=103;
|
||||
exit;
|
||||
end;
|
||||
FileRec(f).mode:=fmClosed;
|
||||
if FileRec(f).Handle>4 then
|
||||
Do_Close(FileRec(f).Handle);
|
||||
End;
|
||||
|
||||
|
||||
Procedure Erase(var f : File);[IOCheck];
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
If FileRec(f).mode=fmClosed Then
|
||||
Do_Erase(PChar(@FileRec(f).Name));
|
||||
End;
|
||||
@ -305,7 +350,8 @@ End;
|
||||
|
||||
Procedure Rename(var f : File;p:pchar);[IOCheck];
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
If FileRec(f).mode=fmClosed Then
|
||||
Begin
|
||||
Do_Rename(PChar(@FileRec(f).Name),p);
|
||||
@ -318,7 +364,8 @@ Procedure Rename(var f : File;const s : string);[IOCheck];
|
||||
var
|
||||
p : array[0..255] Of Char;
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
Move(s[1],p,Length(s));
|
||||
p[Length(s)]:=#0;
|
||||
Rename(f,Pchar(@p));
|
||||
@ -329,7 +376,8 @@ Procedure Rename(var f : File;c : char);[IOCheck];
|
||||
var
|
||||
p : array[0..1] Of Char;
|
||||
Begin
|
||||
If InOutRes <> 0 then exit;
|
||||
If InOutRes <> 0 then
|
||||
exit;
|
||||
p[0]:=c;
|
||||
p[1]:=#0;
|
||||
Rename(f,Pchar(@p));
|
||||
@ -337,7 +385,10 @@ End;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.8 1998-09-17 16:34:16 peter
|
||||
Revision 1.9 1998-11-29 22:28:11 peter
|
||||
+ io-error 103 added
|
||||
|
||||
Revision 1.8 1998/09/17 16:34:16 peter
|
||||
* new eof,eoln,seekeoln,seekeof
|
||||
* speed upgrade for read_string
|
||||
* inoutres 104/105 updates for read_* and write_*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user