Вернул назад реализацию Print с пробелами между

This commit is contained in:
Mikhalkovich Stanislav 2021-11-07 00:08:26 +03:00
parent 69fde2069b
commit ace0233806
10 changed files with 65 additions and 127 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "8";
public const string Build = "2";
public const string Revision = "3014";
public const string Revision = "3015";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=2
%REVISION%=3014
%MINOR%=8
%REVISION%=3015
%COREVERSION%=2
%MAJOR%=3

View file

@ -12,13 +12,13 @@
<table border=0 cellpadding=5><tr><td><code><b>function</b> Deserialize(filename: string): object;</code>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Äåñåðèàëèçóåò îáúåêò èç ôàéëà</td></tr>
<tr><td><code><b>procedure</b> Print(a,b,...);</code>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... на экран, разделяя их пробелами</td></tr>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... на экран, после каждого значения выводит пробел</td></tr>
<tr><td><code><b>procedure</b> Print(f: Text; a,b,...);</code>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... в текстовый файл f, разделяя их пробелами</td></tr>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел</td></tr>
<tr><td><code><b>procedure</b> Println(a,b,...);</code>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... на экран, разделяя их пробелами, и переходит на новую строку</td></tr>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... на экран, после каждого значения выводит пробел и переходит на новую строку</td></tr>
<tr><td><code><b>procedure</b> Println(f: Text; a,b,...);</code>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... в текстовый файл f, разделяя их пробелами, и переходит на новую строку</td></tr>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел и переходит на новую строку</td></tr>
<tr><td><code><b>procedure</b> Serialize(filename: string; obj: object);</code>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ñåðèàëèçóåò îáúåêò â ôàéë (îáúåêò äîëæåí èìåòü àòðèáóò [Serializable])</td></tr>
<tr><td><code><b>procedure</b> Write(a,b,...);</code>

View file

@ -1 +1 @@
3.8.2.3014
3.8.2.3015

View file

@ -1 +1 @@
!define VERSION '3.8.2.3014'
!define VERSION '3.8.2.3015'

View file

@ -379,7 +379,6 @@ type
fi: FileInfo;
sr: StreamReader;
sw: TextWriter;
PrintState: integer := 0; // 0 - до любого вывода и в начале строки
public
/// Возвращает значение типа integer, введенное из текстового файла
function ReadInteger: integer;
@ -1197,20 +1196,20 @@ procedure WriteFormat(f: Text; formatstr: string; params args: array of object);
procedure WritelnFormat(f: Text; formatstr: string; params args: array of object);
///- procedure Print(a,b,...);
/// Выводит значения a,b,... на экран, разделяя их пробелами
/// Выводит значения a,b,... на экран, после каждого значения выводит пробел
procedure Print(o: object);
///--
procedure Print(s: string);
///--
procedure Print(params args: array of object);
///- procedure Print(f: Text; a,b,...);
/// Выводит значения a,b,... в текстовый файл f, разделяя их пробелами
/// Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел
procedure Print(f: Text; params args: array of object);
///- procedure Println(a,b,...);
/// Выводит значения a,b,... на экран, разделяя их пробелами, и переходит на новую строку
/// Выводит значения a,b,... на экран, после каждого значения выводит пробел и переходит на новую строку
procedure Println(params args: array of object);
///- procedure Println(f: Text; a,b,...);
/// Выводит значения a,b,... в текстовый файл f, разделяя их пробелами, и переходит на новую строку
/// Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел и переходит на новую строку
procedure Println(f: Text; params args: array of object);
/// Сериализует объект в файл (объект должен иметь атрибут [Serializable])
@ -6571,19 +6570,17 @@ procedure Text.Writeln(params o: array of Object) := PABCSystem.Writeln(Self, o)
procedure Text.Print(params o: array of Object);
begin
PABCSystem.Print(Self,o);
{if PrintDelimDefault<>'' then
if PrintDelimDefault<>'' then
foreach var s in o do
PABCSystem.Write(Self, s, PrintDelimDefault)
else
foreach var s in o do
PABCSystem.Write(Self, s)}
PABCSystem.Write(Self, s)
end;
procedure Text.Println(params o: array of Object);
begin
PABCSystem.Println(Self,o);
{if o.Length <> 0 then
if o.Length <> 0 then
begin
if PrintDelimDefault<>'' then
for var i:=0 to o.Length-2 do
@ -6593,7 +6590,7 @@ begin
PABCSystem.Write(Self, o[i]);
PABCSystem.Write(Self, o.Last);
end;
PABCSystem.Writeln(Self);}
PABCSystem.Writeln(Self);
end;
function Text.Eof := PABCSystem.Eof(Self);
@ -6817,7 +6814,7 @@ begin
end;
// -----------------------------------------------------
// PointerOutput # PointerOutput subroutines
// Write - Writeln # Write subroutines
// -----------------------------------------------------
function PointerOutput.ToString: string;
begin
@ -6829,11 +6826,6 @@ begin
p := ptr;
end;
// -----------------------------------------------------
// Write - Writeln # Write subroutines
// -----------------------------------------------------
var PrintState := 0; // 0 в начале строки; 1 - после вывода без перехода на новую строку
procedure Write;
begin
end;
@ -6924,7 +6916,6 @@ begin
if output.sw is StreamWriter then
writeln_in_output
else CurrentIOSystem.Writeln;
PrintState := 0;
end;
procedure Writeln(params args: array of object);
@ -6941,7 +6932,6 @@ begin
CurrentIOSystem.Write(args[i]);
CurrentIOSystem.Writeln;
end;
PrintState := 0;
end;
procedure Write(f: Text);
@ -6956,6 +6946,19 @@ begin
raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING));
f.sw.Write(StructuredObjectToString(val));
{if val = nil then
begin
f.sw.Write('nil');
exit;
end;
case System.Type.GetTypeCode(val.GetType) of
TypeCode.Double,
TypeCode.Single,
TypeCode.Decimal:
f.sw.Write(FormatFloatNumber(val.ToString));
else
f.sw.Write(val)
end;}
end;
procedure Write(f: Text; params args: array of object);
@ -6972,7 +6975,6 @@ begin
raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING));
f.sw.WriteLine;
f.PrintState := 0;
end;
procedure Writeln(f: Text; val: object);
@ -7018,28 +7020,14 @@ end;
procedure Print(s: string);
begin
if PrintDelimDefault<>'' then
begin
if PrintState = 0 then
begin
Write(s);
PrintState := 1
end
else Write(PrintDelimDefault, s)
end
Write(s, PrintDelimDefault)
else Write(s)
end;
procedure Print(o: object);
begin
if PrintDelimDefault<>'' then
begin
if PrintState = 0 then
begin
Write(o);
PrintState := 1
end
else Write(PrintDelimDefault, o)
end
Write(o, PrintDelimDefault)
else
Write(o)
end;
@ -7048,37 +7036,27 @@ procedure Print(params args: array of object);
begin
if args.Length = 0 then
exit;
{if PrintDelimDefault<>'' then
if PrintDelimDefault<>'' then
for var i := 0 to args.length - 1 do
Write(args[i], PrintDelimDefault)
else
for var i := 0 to args.length - 1 do
Write(args[i])}
for var i := 0 to args.Length - 1 do
Print(args[i])
Write(args[i])
end;
procedure Println(params args: array of object);
begin
Print(args);
Writeln;
PrintState := 0;
end;
var FilePrintState := 0;// Хранить FilePrintState в типе Text!!!
procedure Print(f: Text; params args: array of object);
begin
if args.Length = 0 then
exit;
if PrintDelimDefault<>'' then
for var i := 0 to args.length - 1 do
if f.PrintState = 0 then
begin
Write(f, args[i]);
f.PrintState := 1
end
else Write(f, PrintDelimDefault, args[i])
Write(f, args[i], PrintDelimDefault)
else
for var i := 0 to args.length - 1 do
Write(f, args[i])
@ -7088,7 +7066,6 @@ procedure Println(f: Text; params args: array of object);
begin
Print(f, args);
Writeln(f);
f.PrintState := 0;
end;
procedure Serialize(filename: string; obj: object);
@ -7112,9 +7089,6 @@ end;
// -----------------------------------------------------
procedure Assign(f: Text; name: string);
begin
f.PrintState := 0;
if f = input then
PrintState := 0;
try
f.fi := System.IO.FileInfo.Create(name);
except
@ -7137,7 +7111,6 @@ procedure AssignFile(f: Text; name: string) := Assign(f, name);
procedure Close(f: Text);
begin
f.PrintState := 0;
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
if f.sr <> nil then
@ -7165,7 +7138,6 @@ procedure Reset(f: Text; en: Encoding);
begin
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
f.PrintState := 0;
if f.sr = nil then
begin
f.sr := new StreamReader(f.fi.FullName, en);
@ -7206,7 +7178,6 @@ procedure Rewrite(f: Text; en: Encoding);
begin
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
f.PrintState := 0;
if f.sw = nil then
begin
f.sw := new StreamWriter(f.fi.FullName, False, en);
@ -7240,7 +7211,6 @@ procedure Append(f: Text; en: Encoding);
begin
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
f.PrintState := 0;
f.sw := new StreamWriter(f.fi.FullName, True, en);
end;
@ -14180,7 +14150,6 @@ begin
(listener as System.Diagnostics.DefaultTraceListener).AssertUiEnabled := true; }
__FixPointer(nil);
StartTime := DateTime.Now;
PrintState := 0;
end;
procedure __InitModule__;
@ -14200,7 +14169,6 @@ end;
procedure __FinalizeModule__;
begin
PrintState := 0;
if (output.sw <> nil) and (output.sw is StreamWriter) and ((output.sw as StreamWriter).BaseStream <> nil) then
output.sw.Close;
if (ErrOutput.sw <> nil) and (ErrOutput.sw is StreamWriter) and ((ErrOutput.sw as StreamWriter).BaseStream <> nil) then

View file

@ -80,6 +80,8 @@ type
[PrintAttribute(' ', 4, -5)]
property УчитсяВКШ: boolean read _inSunSchool;
end;}
///!#
Ученик = auto class
Фамилия: string;
Класс, Рост: integer;

View file

@ -379,7 +379,6 @@ type
fi: FileInfo;
sr: StreamReader;
sw: TextWriter;
PrintState: integer := 0; // 0 - до любого вывода и в начале строки
public
/// Возвращает значение типа integer, введенное из текстового файла
function ReadInteger: integer;
@ -1197,20 +1196,20 @@ procedure WriteFormat(f: Text; formatstr: string; params args: array of object);
procedure WritelnFormat(f: Text; formatstr: string; params args: array of object);
///- procedure Print(a,b,...);
/// Выводит значения a,b,... на экран, разделяя их пробелами
/// Выводит значения a,b,... на экран, после каждого значения выводит пробел
procedure Print(o: object);
///--
procedure Print(s: string);
///--
procedure Print(params args: array of object);
///- procedure Print(f: Text; a,b,...);
/// Выводит значения a,b,... в текстовый файл f, разделяя их пробелами
/// Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел
procedure Print(f: Text; params args: array of object);
///- procedure Println(a,b,...);
/// Выводит значения a,b,... на экран, разделяя их пробелами, и переходит на новую строку
/// Выводит значения a,b,... на экран, после каждого значения выводит пробел и переходит на новую строку
procedure Println(params args: array of object);
///- procedure Println(f: Text; a,b,...);
/// Выводит значения a,b,... в текстовый файл f, разделяя их пробелами, и переходит на новую строку
/// Выводит значения a,b,... в текстовый файл f, после каждого значения выводит пробел и переходит на новую строку
procedure Println(f: Text; params args: array of object);
/// Сериализует объект в файл (объект должен иметь атрибут [Serializable])
@ -6571,19 +6570,17 @@ procedure Text.Writeln(params o: array of Object) := PABCSystem.Writeln(Self, o)
procedure Text.Print(params o: array of Object);
begin
PABCSystem.Print(Self,o);
{if PrintDelimDefault<>'' then
if PrintDelimDefault<>'' then
foreach var s in o do
PABCSystem.Write(Self, s, PrintDelimDefault)
else
foreach var s in o do
PABCSystem.Write(Self, s)}
PABCSystem.Write(Self, s)
end;
procedure Text.Println(params o: array of Object);
begin
PABCSystem.Println(Self,o);
{if o.Length <> 0 then
if o.Length <> 0 then
begin
if PrintDelimDefault<>'' then
for var i:=0 to o.Length-2 do
@ -6593,7 +6590,7 @@ begin
PABCSystem.Write(Self, o[i]);
PABCSystem.Write(Self, o.Last);
end;
PABCSystem.Writeln(Self);}
PABCSystem.Writeln(Self);
end;
function Text.Eof := PABCSystem.Eof(Self);
@ -6817,7 +6814,7 @@ begin
end;
// -----------------------------------------------------
// PointerOutput # PointerOutput subroutines
// Write - Writeln # Write subroutines
// -----------------------------------------------------
function PointerOutput.ToString: string;
begin
@ -6829,11 +6826,6 @@ begin
p := ptr;
end;
// -----------------------------------------------------
// Write - Writeln # Write subroutines
// -----------------------------------------------------
var PrintState := 0; // 0 в начале строки; 1 - после вывода без перехода на новую строку
procedure Write;
begin
end;
@ -6924,7 +6916,6 @@ begin
if output.sw is StreamWriter then
writeln_in_output
else CurrentIOSystem.Writeln;
PrintState := 0;
end;
procedure Writeln(params args: array of object);
@ -6941,7 +6932,6 @@ begin
CurrentIOSystem.Write(args[i]);
CurrentIOSystem.Writeln;
end;
PrintState := 0;
end;
procedure Write(f: Text);
@ -6956,6 +6946,19 @@ begin
raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING));
f.sw.Write(StructuredObjectToString(val));
{if val = nil then
begin
f.sw.Write('nil');
exit;
end;
case System.Type.GetTypeCode(val.GetType) of
TypeCode.Double,
TypeCode.Single,
TypeCode.Decimal:
f.sw.Write(FormatFloatNumber(val.ToString));
else
f.sw.Write(val)
end;}
end;
procedure Write(f: Text; params args: array of object);
@ -6972,7 +6975,6 @@ begin
raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING));
f.sw.WriteLine;
f.PrintState := 0;
end;
procedure Writeln(f: Text; val: object);
@ -7018,28 +7020,14 @@ end;
procedure Print(s: string);
begin
if PrintDelimDefault<>'' then
begin
if PrintState = 0 then
begin
Write(s);
PrintState := 1
end
else Write(PrintDelimDefault, s)
end
Write(s, PrintDelimDefault)
else Write(s)
end;
procedure Print(o: object);
begin
if PrintDelimDefault<>'' then
begin
if PrintState = 0 then
begin
Write(o);
PrintState := 1
end
else Write(PrintDelimDefault, o)
end
Write(o, PrintDelimDefault)
else
Write(o)
end;
@ -7048,37 +7036,27 @@ procedure Print(params args: array of object);
begin
if args.Length = 0 then
exit;
{if PrintDelimDefault<>'' then
if PrintDelimDefault<>'' then
for var i := 0 to args.length - 1 do
Write(args[i], PrintDelimDefault)
else
for var i := 0 to args.length - 1 do
Write(args[i])}
for var i := 0 to args.Length - 1 do
Print(args[i])
Write(args[i])
end;
procedure Println(params args: array of object);
begin
Print(args);
Writeln;
PrintState := 0;
end;
var FilePrintState := 0;// Хранить FilePrintState в типе Text!!!
procedure Print(f: Text; params args: array of object);
begin
if args.Length = 0 then
exit;
if PrintDelimDefault<>'' then
for var i := 0 to args.length - 1 do
if f.PrintState = 0 then
begin
Write(f, args[i]);
f.PrintState := 1
end
else Write(f, PrintDelimDefault, args[i])
Write(f, args[i], PrintDelimDefault)
else
for var i := 0 to args.length - 1 do
Write(f, args[i])
@ -7088,7 +7066,6 @@ procedure Println(f: Text; params args: array of object);
begin
Print(f, args);
Writeln(f);
f.PrintState := 0;
end;
procedure Serialize(filename: string; obj: object);
@ -7112,9 +7089,6 @@ end;
// -----------------------------------------------------
procedure Assign(f: Text; name: string);
begin
f.PrintState := 0;
if f = input then
PrintState := 0;
try
f.fi := System.IO.FileInfo.Create(name);
except
@ -7137,7 +7111,6 @@ procedure AssignFile(f: Text; name: string) := Assign(f, name);
procedure Close(f: Text);
begin
f.PrintState := 0;
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
if f.sr <> nil then
@ -7165,7 +7138,6 @@ procedure Reset(f: Text; en: Encoding);
begin
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
f.PrintState := 0;
if f.sr = nil then
begin
f.sr := new StreamReader(f.fi.FullName, en);
@ -7206,7 +7178,6 @@ procedure Rewrite(f: Text; en: Encoding);
begin
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
f.PrintState := 0;
if f.sw = nil then
begin
f.sw := new StreamWriter(f.fi.FullName, False, en);
@ -7240,7 +7211,6 @@ procedure Append(f: Text; en: Encoding);
begin
if f.fi = nil then
raise new IOException(GetTranslation(FILE_NOT_ASSIGNED));
f.PrintState := 0;
f.sw := new StreamWriter(f.fi.FullName, True, en);
end;
@ -14180,7 +14150,6 @@ begin
(listener as System.Diagnostics.DefaultTraceListener).AssertUiEnabled := true; }
__FixPointer(nil);
StartTime := DateTime.Now;
PrintState := 0;
end;
procedure __InitModule__;
@ -14200,7 +14169,6 @@ end;
procedure __FinalizeModule__;
begin
PrintState := 0;
if (output.sw <> nil) and (output.sw is StreamWriter) and ((output.sw as StreamWriter).BaseStream <> nil) then
output.sw.Close;
if (ErrOutput.sw <> nil) and (ErrOutput.sw is StreamWriter) and ((ErrOutput.sw as StreamWriter).BaseStream <> nil) then

Binary file not shown.

Binary file not shown.