From 85320d6787f79e1bdc7e0589102228f2809bdbda Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Tue, 21 Sep 2004 23:36:51 +0000 Subject: [PATCH] * SetTextLineEnding implemented, FileRec.Name position alignment for CPU64 --- compiler/symdef.pas | 11 +++++++---- rtl/inc/filerec.inc | 7 +++++-- rtl/inc/text.inc | 16 +++++++++++----- rtl/inc/textrec.inc | 17 ++++++++++++++--- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/compiler/symdef.pas b/compiler/symdef.pas index de06323a3e..04d8badf21 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -2237,15 +2237,15 @@ implementation {$ifdef cpu64bit} case filetyp of ft_text : - savesize:=608; + savesize:=612; ft_typed, ft_untyped : - savesize:=320; + savesize:=352; end; {$else cpu64bit} case filetyp of ft_text : - savesize:=572; + savesize:=576; ft_typed, ft_untyped : savesize:=316; @@ -6184,7 +6184,10 @@ implementation end. { $Log$ - Revision 1.255 2004-09-21 17:25:12 peter + Revision 1.256 2004-09-21 23:36:51 hajny + * SetTextLineEnding implemented, FileRec.Name position alignment for CPU64 + + Revision 1.255 2004/09/21 17:25:12 peter * paraloc branch merged Revision 1.254 2004/09/14 16:33:17 peter diff --git a/rtl/inc/filerec.inc b/rtl/inc/filerec.inc index a1fac63047..6d09cd4b09 100644 --- a/rtl/inc/filerec.inc +++ b/rtl/inc/filerec.inc @@ -28,14 +28,17 @@ type Handle : THandle; Mode : longint; RecSize : SizeInt; - _private : array[1..32] of byte; + _private : array[1..3 * SizeOf(SizeInt) + 5 * SizeOf (pointer)] of byte; UserData : array[1..16] of byte; name : array[0..filerecnamelength] of char; End; { $Log$ - Revision 1.5 2004-02-05 01:16:12 florian + Revision 1.6 2004-09-21 23:36:51 hajny + * SetTextLineEnding implemented, FileRec.Name position alignment for CPU64 + + Revision 1.5 2004/02/05 01:16:12 florian + completed x86-64/linux system unit Revision 1.4 2003/11/03 09:42:27 marco diff --git a/rtl/inc/text.inc b/rtl/inc/text.inc index f162aa83df..28180ad5ae 100644 --- a/rtl/inc/text.inc +++ b/rtl/inc/text.inc @@ -87,6 +87,7 @@ Begin TextRec(t).BufSize:=TextRecBufSize; TextRec(t).Bufptr:=@TextRec(t).Buffer; TextRec(t).OpenFunc:=@FileOpenFunc; + TextRec(t).LineEnd:=LineEnding; Move(s[1],TextRec(t).Name,Length(s)); End; @@ -435,6 +436,11 @@ Begin TextRec(f).BufEnd:=0; End; +Procedure SetTextLineEnding(Var f:Text; Ending:string); +Begin + TextRec(F).LineEnd:=Ending; +End; + {***************************************************************************** Write(Ln) @@ -489,16 +495,13 @@ end; Procedure fpc_Writeln_End(var f:Text);[Public,Alias:'FPC_WRITELN_END']; iocheck; {$ifdef hascompilerproc} compilerproc; {$endif} -var - eol : array[0..3] of char; begin If InOutRes <> 0 then exit; case TextRec(f).mode of fmOutput { fmAppend gets changed to fmOutPut in do_open (JM) }: begin - eol:=sLineBreak; { Write EOL } - fpc_WriteBuffer(f,eol,length(sLineBreak)); + fpc_WriteBuffer(f,TextRec(f).LineEnd[1],length(TextRec(f).LineEnd)); { Flush } if TextRec(f).FlushFunc<>nil then FileFunc(TextRec(f).FlushFunc)(TextRec(f)); @@ -1274,7 +1277,10 @@ end; { $Log$ - Revision 1.25 2004-08-20 10:04:39 olle + Revision 1.26 2004-09-21 23:36:51 hajny + * SetTextLineEnding implemented, FileRec.Name position alignment for CPU64 + + Revision 1.25 2004/08/20 10:04:39 olle * prefixed write[buffer|blanks] with fpc_ and made them externally visible Revision 1.24 2004/06/21 18:48:48 olle diff --git a/rtl/inc/textrec.inc b/rtl/inc/textrec.inc index 48539841cc..1e0ec6fde3 100644 --- a/rtl/inc/textrec.inc +++ b/rtl/inc/textrec.inc @@ -25,12 +25,17 @@ const TextRecNameLength = 256; TextRecBufSize = 256; type + TLineEndStr = string [3]; TextBuf = array[0..TextRecBufSize-1] of char; TextRec = Packed Record Handle : THandle; Mode : longint; - bufsize, - _private, + bufsize : SizeInt; +{$IFDEF FPC_LINEEND_IN_TEXTREC} + _private : SizeInt; +{$ELSE FPC_LINEEND_IN_TEXTREC} + LineEnd : TLineEndStr; +{$ENDIF FPC_LINEEND_IN_TEXTREC} bufpos, bufend : SizeInt; bufptr : ^textbuf; @@ -40,12 +45,18 @@ type closefunc : pointer; UserData : array[1..16] of byte; name : array[0..textrecnamelength-1] of char; +{$IFDEF FPC_LINEEND_IN_TEXTREC} + LineEnd : TLineEndStr; +{$ENDIF FPC_LINEEND_IN_TEXTREC} buffer : textbuf; End; { $Log$ - Revision 1.6 2004-05-18 20:16:23 peter + Revision 1.7 2004-09-21 23:36:51 hajny + * SetTextLineEnding implemented, FileRec.Name position alignment for CPU64 + + Revision 1.6 2004/05/18 20:16:23 peter * unix thandle is always 32bit * textrec fixed for 64bit