mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 06:29:32 +02:00
+ added helper functions for read/readln longint/longword on 16/8-bit cpus
git-svn-id: branches/i8086@24047 -
This commit is contained in:
parent
9b79c52f32
commit
8b6b832677
@ -478,6 +478,10 @@ procedure fpc_Read_Text_Currency(var f : Text; out v : Currency); compilerproc;
|
||||
Procedure fpc_Read_Text_QWord(var f : text; out q : qword); compilerproc;
|
||||
Procedure fpc_Read_Text_Int64(var f : text; out i : int64); compilerproc;
|
||||
{$endif CPU64}
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
Procedure fpc_Read_Text_LongWord(var f : text; out q : longword); compilerproc;
|
||||
Procedure fpc_Read_Text_LongInt(var f : text; out i : longint); compilerproc;
|
||||
{$endif CPU16 or CPU8}
|
||||
function fpc_GetBuf(var f : Text) : pchar; compilerproc;
|
||||
{$endif FPC_HAS_FEATURE_TEXTIO}
|
||||
|
||||
|
@ -1737,6 +1737,52 @@ End;
|
||||
|
||||
{$endif CPU64}
|
||||
|
||||
{$if defined(CPU16) or defined(CPU8)}
|
||||
procedure fpc_Read_Text_LongWord(var f : text; out q : longword); iocheck; compilerproc;
|
||||
var
|
||||
hs : String;
|
||||
code : longint;
|
||||
Begin
|
||||
q:=0;
|
||||
If not CheckRead(f) then
|
||||
exit;
|
||||
hs:='';
|
||||
if IgnoreSpaces(f) then
|
||||
begin
|
||||
{ When spaces were found and we are now at EOF,
|
||||
then we return 0 }
|
||||
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
|
||||
exit;
|
||||
ReadNumeric(f,hs);
|
||||
end;
|
||||
val(hs,q,code);
|
||||
If code<>0 Then
|
||||
InOutRes:=106;
|
||||
End;
|
||||
|
||||
procedure fpc_Read_Text_LongInt(var f : text; out i : longint); iocheck; compilerproc;
|
||||
var
|
||||
hs : String;
|
||||
code : Longint;
|
||||
Begin
|
||||
i:=0;
|
||||
If not CheckRead(f) then
|
||||
exit;
|
||||
hs:='';
|
||||
if IgnoreSpaces(f) then
|
||||
begin
|
||||
{ When spaces were found and we are now at EOF,
|
||||
then we return 0 }
|
||||
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
|
||||
exit;
|
||||
ReadNumeric(f,hs);
|
||||
end;
|
||||
Val(hs,i,code);
|
||||
If code<>0 Then
|
||||
InOutRes:=106;
|
||||
End;
|
||||
{$endif CPU16 or CPU8}
|
||||
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user