Bläddra i källkod

+ added write/writeln helpers in the RTL for writing longints/longwords on 16/8-bit CPUs

git-svn-id: branches/i8086@24006 -
nickysn 12 år sedan
förälder
incheckning
697de721ef
2 ändrade filer med 61 tillägg och 0 borttagningar
  1. 6 0
      rtl/inc/compproc.inc
  2. 55 0
      rtl/inc/text.inc

+ 6 - 0
rtl/inc/compproc.inc

@@ -358,6 +358,12 @@ procedure fpc_write_text_int64(len : longint;var t : text;i : int64); compilerpr
 procedure fpc_write_text_qword_iso(len : longint;var t : text;q : qword); compilerproc;
 procedure fpc_write_text_qword_iso(len : longint;var t : text;q : qword); compilerproc;
 procedure fpc_write_text_int64_iso(len : longint;var t : text;i : int64); compilerproc;
 procedure fpc_write_text_int64_iso(len : longint;var t : text;i : int64); compilerproc;
 {$endif CPU64}
 {$endif CPU64}
+{$if defined(CPU16) or defined(CPU8)}
+procedure fpc_write_text_longword(len : longint;var t : text;q : longword); compilerproc;
+procedure fpc_write_text_longint(len : longint;var t : text;i : longint); compilerproc;
+procedure fpc_write_text_longword_iso(len : longint;var t : text;q : longword); compilerproc;
+procedure fpc_write_text_longint_iso(len : longint;var t : text;i : longint); compilerproc;
+{$endif CPU16 or CPU8}
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
 Procedure fpc_Write_Text_Float(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); compilerproc;
 Procedure fpc_Write_Text_Float(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); compilerproc;
 Procedure fpc_Write_Text_Float_Iso(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); compilerproc;
 Procedure fpc_Write_Text_Float_Iso(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); compilerproc;

+ 55 - 0
rtl/inc/text.inc

@@ -893,6 +893,61 @@ end;
 
 
 {$endif CPU64}
 {$endif CPU64}
 
 
+{$if defined(CPU16) or defined(CPU8)}
+procedure fpc_write_text_longword(len : longint;var t : text;q : longword); iocheck; compilerproc;
+var
+  s : string;
+begin
+  if (InOutRes<>0) then
+   exit;
+  str(q,s);
+  write_str(len,t,s);
+end;
+
+
+procedure fpc_write_text_longint(len : longint;var t : text;i : longint); iocheck; compilerproc;
+var
+  s : string;
+begin
+  if (InOutRes<>0) then
+   exit;
+  str(i,s);
+  write_str(len,t,s);
+end;
+
+
+procedure fpc_write_text_longword_iso(len : longint;var t : text;q : longword); iocheck; compilerproc;
+var
+  s : string;
+begin
+  if (InOutRes<>0) then
+    exit;
+  str(q,s);
+  { default value? }
+  if len=-1 then
+    len:=11
+  else if len<length(s) then
+    len:=length(s);
+  write_str_iso(len,t,s);
+end;
+
+
+procedure fpc_write_text_longint_iso(len : longint;var t : text;i : longint); iocheck; compilerproc;
+var
+  s : string;
+begin
+  if (InOutRes<>0) then
+   exit;
+  str(i,s);
+  { default value? }
+  if len=-1 then
+    len:=11
+  else if len<length(s) then
+    len:=length(s);
+  write_str_iso(len,t,s);
+end;
+{$endif CPU16 or CPU8}
+
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
 Procedure fpc_Write_Text_Float(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); iocheck; compilerproc;
 Procedure fpc_Write_Text_Float(rt,fixkomma,Len : Longint;var t : Text;r : ValReal); iocheck; compilerproc;
 var
 var