From e124b9f8327548dc63f94b6ed9ccd36dc72c2a1d Mon Sep 17 00:00:00 2001
From: Mikhalkovich Stanislav
- ReadSeqInteger:for var i:=0 to a.Length-1
do
read(a[i]);
+ ReadArrInteger:var a := ReadSeqInteger(10);
var a := ReadArrInteger(10);
.
write , diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index cf1815957..733f4c39f 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.8.2.3027 +3.8.2.3032 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 1965b8f30..e8f0557a4 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.8.2.3027' +!define VERSION '3.8.2.3032' diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 579943c8c..13b3be037 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -14106,9 +14106,9 @@ begin try DefaultEncoding := Encoding.GetEncoding(1251); if (System.Environment.OSVersion.Version.Major >= 6) and (System.Environment.OSVersion.Version.Minor >= 2) then - System.Console.OutputEncoding := Encoding.GetEncoding(1251); + System.Console.OutputEncoding := Encoding.UTF8; except - DefaultEncoding := Encoding.UTF8; + //DefaultEncoding := Encoding.UTF8; DefaultEncoding := new System.Text.UTF8Encoding(false) end; rnd := new System.Random; @@ -14139,7 +14139,7 @@ begin System.Threading.Thread.CurrentThread.CurrentCulture := new System.Globalization.CultureInfo('en-US'); var defaultCulture := typeof(System.Globalization.CultureInfo).GetProperty('DefaultThreadCurrentCulture'); if defaultCulture <> nil then - defaultCulture.SetValue(nil, new System.Globalization.CultureInfo('en-US')); + defaultCulture.SetValue(nil, new System.Globalization.CultureInfo('en-US'), nil); input := new TextFile(); output := new TextFile(); output.sw := Console.Out; diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 13b3be037..8bcffc9f0 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -307,6 +307,10 @@ type // ----------------------------------------------------- // IOSystem interface & IOStandardSystem implementation // ----------------------------------------------------- + +// размер буфера. Определен эмпирически +const buflen = 256; + type /// Интерфейс подсистемы ввода/вывода IOSystem = interface @@ -338,7 +342,7 @@ type IOStandardSystem = class(IOSystem) state := 0; // 0 - нет символа в буфере char, 1 - есть символ в буфере char sym: integer; // буфер в 1 символ для моделирования Peek в консоли - buf: array of char; + buf: array of char := new char[buflen]; pos := 0; realbuflen := -1; // только вначале tr: TextReader; @@ -2859,6 +2863,8 @@ const MATR_DIMENSIONS_MUST_BE_EQUAL = 'Размеры матриц должны совпадать!!Matrix dimensions must be equal'; COUNT_PARAMS_MAXFUN_MUSTBE_GREATER1 = 'Количество параметров функции Max должно быть > 1!!The number of parameters of the Max function must be > 1'; COUNT_PARAMS_MINFUN_MUSTBE_GREATER1 = 'Количество параметров функции Min должно быть > 1!!The number of parameters of the Min function must be > 1'; + Format_InvalidString = 'Входная строка имела неверный формат!!Input string was not in a correct format'; + Overflow_Int32 = 'Целочисленное переполнение!!Integer overflow'; // ----------------------------------------------------- // WINAPI // ----------------------------------------------------- @@ -5279,16 +5285,15 @@ end; // IOStandardSystem: implementation // ----------------------------------------------------- -// размер буфера. Определен эмпирически -const - buflen = 256; - constructor IOStandardSystem.Create; begin tr := Console.In; - buf := new char[buflen]; + //buf := new char[buflen]; - теперь при объявлении поля end; +const + m = char(-1); + procedure IOStandardSystem.ReadNextBuf; begin realbuflen := tr.ReadBlock(buf, 0, buflen); @@ -5297,8 +5302,6 @@ begin pos := 0; end; -const - m = char(-1); var _IsPipedRedirectedQuery := False; @@ -5524,11 +5527,12 @@ begin end; end; -function ErrorStringFromResource(s: string): string; +{function ErrorStringFromResource(s: string): string; begin - var _rm := new System.Resources.ResourceManager('mscorlib', typeof(object).Assembly); - Result := _rm.GetString(s); -end; + //var _rm := new System.Resources.ResourceManager('mscorlib', typeof(object).Assembly); + //Result := _rm.GetString(s); + Result := GetTranslation(s); +end;} procedure IOStandardSystem.read(var x: integer); begin @@ -5557,7 +5561,7 @@ begin raise new System.IO.IOException(GetTranslation(READ_LEXEM_AFTER_END_OF_INPUT_STREAM)); if (c < #48) or (c > #57) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString') + ' ' + Ord(c)); + raise new System.FormatException(GetTranslation(Format_InvalidString) + ' ' + Ord(c)); x := integer(c) - 48; repeat @@ -5574,11 +5578,11 @@ begin break; if c > #57 then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString') + ' ' + Ord(c)); + raise new System.FormatException(GetTranslation(Format_InvalidString) + ' ' + Ord(c)); if c < #48 then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString') + ' ' + Ord(c)); + raise new System.FormatException(GetTranslation(Format_InvalidString) + ' ' + Ord(c)); if x > 214748364 then - raise new System.OverflowException(ErrorStringFromResource('Overflow_Int32')); + raise new System.OverflowException(GetTranslation(Overflow_Int32)); x := x * 10 + (integer(c) - 48); pos += 1; @@ -5587,7 +5591,7 @@ begin if x < 0 then if (x = -2147483648) and (sign = -1) then exit - else raise new System.OverflowException(ErrorStringFromResource('Overflow_Int32')); + else raise new System.OverflowException(GetTranslation(Overflow_Int32)); if sign = -1 then x := -x; end @@ -9041,7 +9045,7 @@ begin while (j <= s.Length) and char.IsWhiteSpace(s[j]) do j += 1; if (j > s.Length) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); var sign := 0; if s[j] = '-' then begin @@ -9054,10 +9058,10 @@ begin j += 1; end; if (j > s.Length) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); var c := integer(s[j]); if (c < 48) or (c > 57) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); Result := c - 48; j += 1; while j <= s.Length do @@ -9068,20 +9072,20 @@ begin if c < 48 then break; if Result > 214748364 then - raise new System.OverflowException(ErrorStringFromResource('Overflow_Int32')); + raise new System.OverflowException(GetTranslation(Overflow_Int32)); Result := Result * 10 + (c - 48); j += 1; end; if Result < 0 then if (Result = -2147483648) and (sign = -1) then exit - else raise new System.OverflowException(ErrorStringFromResource('Overflow_Int32')); + else raise new System.OverflowException(GetTranslation(Overflow_Int32)); if sign = -1 then Result := -Result; while (j <= s.Length) and char.IsWhiteSpace(s[j]) do j += 1; if j <= s.Length then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); end; function TryStrToInt(s: string; var value: integer): boolean; @@ -9170,7 +9174,7 @@ begin while (from <= s.Length) and char.IsWhiteSpace(s[from]) do from += 1; if (from > s.Length) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); var sign := 0; if s[from] = '-' then begin @@ -9183,10 +9187,10 @@ begin from += 1; end; if (from > s.Length) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); var c := integer(s[from]); if (c < 48) or (c > 57) then - raise new System.FormatException(ErrorStringFromResource('Format_InvalidString')); + raise new System.FormatException(GetTranslation(Format_InvalidString)); Result := c - 48; from += 1; while from <= s.Length do @@ -9197,14 +9201,14 @@ begin if c < 48 then break; if Result > 214748364 then - raise new System.OverflowException(ErrorStringFromResource('Overflow_Int32')); + raise new System.OverflowException(GetTranslation(Overflow_Int32)); Result := Result * 10 + (c - 48); from += 1; end; if Result < 0 then if (Result = -2147483648) and (sign = -1) then exit - else raise new System.OverflowException(ErrorStringFromResource('Overflow_Int32')); + else raise new System.OverflowException(GetTranslation(Overflow_Int32)); if sign = -1 then Result := -Result; end;