Убрал OpenCLABC из инсталлятора. Он содержит ограничение where T: &Array, которое в ближайшее время будет запрещено.
This commit is contained in:
parent
fdab8e0955
commit
0d31b9bc77
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "5";
|
public const string Minor = "5";
|
||||||
public const string Build = "0";
|
public const string Build = "0";
|
||||||
public const string Revision = "2095";
|
public const string Revision = "2096";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%MINOR%=5
|
|
||||||
%REVISION%=2095
|
|
||||||
%COREVERSION%=0
|
%COREVERSION%=0
|
||||||
|
%REVISION%=2096
|
||||||
|
%MINOR%=5
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.5.0.2095'
|
!define VERSION '3.5.0.2096'
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
RobotTaskMaker, RobotZadan, Sockets, Utils, VCL, Timers, PT4Exam, PT4TaskMakerNET, RBDMUtils,
|
RobotTaskMaker, RobotZadan, Sockets, Utils, VCL, Timers, PT4Exam, PT4TaskMakerNET, RBDMUtils,
|
||||||
Collections, Arrays, Core, FormsABC, MPI, ClientServer, OpenGL, Speech, Sounds, Countries,
|
Collections, Arrays, Core, FormsABC, MPI, ClientServer, OpenGL, Speech, Sounds, Countries,
|
||||||
ABCDatabases,BlockFileOfT,Controls,
|
ABCDatabases,BlockFileOfT,Controls,
|
||||||
OpenCL, OpenCLABC
|
OpenCL{, OpenCLABC}
|
||||||
;
|
;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
File ..\bin\Lib\Sounds.pcu
|
File ..\bin\Lib\Sounds.pcu
|
||||||
File ..\bin\Lib\BlockFileOfT.pcu
|
File ..\bin\Lib\BlockFileOfT.pcu
|
||||||
File ..\bin\Lib\OpenCL.pcu
|
File ..\bin\Lib\OpenCL.pcu
|
||||||
File ..\bin\Lib\OpenCLABC.pcu
|
;File ..\bin\Lib\OpenCLABC.pcu
|
||||||
|
|
||||||
File ..\bin\Lib\PABCRtl.dll
|
File ..\bin\Lib\PABCRtl.dll
|
||||||
File ..\bin\Lib\PABCRtl32.dll
|
File ..\bin\Lib\PABCRtl32.dll
|
||||||
|
|
@ -192,7 +192,7 @@
|
||||||
${AddFile} "Sounds.pcu"
|
${AddFile} "Sounds.pcu"
|
||||||
${AddFile} "BlockFileOfT.pcu"
|
${AddFile} "BlockFileOfT.pcu"
|
||||||
${AddFile} "OpenCL.pcu"
|
${AddFile} "OpenCL.pcu"
|
||||||
${AddFile} "OpenCLABC.pcu"
|
;${AddFile} "OpenCLABC.pcu"
|
||||||
${AddFile} "PABCRtl.dll"
|
${AddFile} "PABCRtl.dll"
|
||||||
${AddFile} "HelixToolkit.Wpf.dll"
|
${AddFile} "HelixToolkit.Wpf.dll"
|
||||||
${AddFile} "HelixToolkit.dll"
|
${AddFile} "HelixToolkit.dll"
|
||||||
|
|
@ -265,7 +265,7 @@
|
||||||
File ..\bin\Lib\Sounds.pas
|
File ..\bin\Lib\Sounds.pas
|
||||||
File ..\bin\Lib\BlockFileOfT.pas
|
File ..\bin\Lib\BlockFileOfT.pas
|
||||||
File ..\bin\Lib\OpenCL.pas
|
File ..\bin\Lib\OpenCL.pas
|
||||||
File ..\bin\Lib\OpenCLABC.pas
|
;File ..\bin\Lib\OpenCLABC.pas
|
||||||
File ..\bin\Lib\__RedirectIOMode.vb
|
File ..\bin\Lib\__RedirectIOMode.vb
|
||||||
File ..\bin\Lib\VBSystem.vb
|
File ..\bin\Lib\VBSystem.vb
|
||||||
|
|
||||||
|
|
@ -324,7 +324,7 @@
|
||||||
${AddFile} "Sounds.pas"
|
${AddFile} "Sounds.pas"
|
||||||
${AddFile} "BlockFileOfT.pas"
|
${AddFile} "BlockFileOfT.pas"
|
||||||
${AddFile} "OpenCL.pas"
|
${AddFile} "OpenCL.pas"
|
||||||
${AddFile} "OpenCLABC.pas"
|
;${AddFile} "OpenCLABC.pas"
|
||||||
${AddFile} "__RedirectIOMode.vb"
|
${AddFile} "__RedirectIOMode.vb"
|
||||||
${AddFile} "VBSystem.vb"
|
${AddFile} "VBSystem.vb"
|
||||||
|
|
||||||
|
|
|
||||||
91
TestSuite/CompilationSamples/ClientServer.pas
Normal file
91
TestSuite/CompilationSamples/ClientServer.pas
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
unit ClientServer;
|
||||||
|
|
||||||
|
uses System.Net, System.Net.Sockets, System.IO;
|
||||||
|
|
||||||
|
var
|
||||||
|
servername := '127.0.0.1';
|
||||||
|
port := 13000;
|
||||||
|
|
||||||
|
/// Çàïóñêàåò ñåðâåð, ïðèíèìàþùèé îò êëèåíòà ñòðîêó è âûïîëíÿþùèé óêàçàííîå äåéñòâèå
|
||||||
|
procedure RunServer(OnProcessCommand: string -> ());
|
||||||
|
begin
|
||||||
|
var server := new TcpListener(IPAddress.Any, port);
|
||||||
|
server.Start();
|
||||||
|
|
||||||
|
while (true) do
|
||||||
|
begin
|
||||||
|
var client := server.AcceptTcpClient();
|
||||||
|
var stream := client.GetStream();
|
||||||
|
|
||||||
|
var br := new BinaryReader(stream);
|
||||||
|
var data := br.ReadString();
|
||||||
|
br.Close();
|
||||||
|
|
||||||
|
stream.Close();
|
||||||
|
client.Close();
|
||||||
|
|
||||||
|
OnProcessCommand(data);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Çàïóñêàåò ñåðâåð, ïðèíèìàþùèé îò êëèåíòà ñòðîêó, âûïîëíÿþùèé óêàçàííîå äåéñòâèå è îòïðàâëÿþùèé ñòðîêó â îòâåò
|
||||||
|
procedure RunServer(OnProcessCommand: string -> string);
|
||||||
|
begin
|
||||||
|
var server := new TcpListener(IPAddress.Any, port);
|
||||||
|
server.Start();
|
||||||
|
|
||||||
|
while (true) do
|
||||||
|
begin
|
||||||
|
var client := server.AcceptTcpClient();
|
||||||
|
var stream := client.GetStream();
|
||||||
|
|
||||||
|
var br := new BinaryReader(stream);
|
||||||
|
var data := br.ReadString();
|
||||||
|
|
||||||
|
data := OnProcessCommand(data);
|
||||||
|
|
||||||
|
var bw := new BinaryWriter(stream);
|
||||||
|
bw.Write(data);
|
||||||
|
bw.Flush();
|
||||||
|
|
||||||
|
stream.Close();
|
||||||
|
client.Close();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Âûçûâàåòñÿ Êëèåíòîì äëÿ îòïðàâêè êîìàíäû Ñåðâåðó
|
||||||
|
procedure SendCommand(s: string);
|
||||||
|
begin
|
||||||
|
var client := new TcpClient(servername,port);
|
||||||
|
var stream := client.GetStream();
|
||||||
|
|
||||||
|
var bw := new BinaryWriter(stream);
|
||||||
|
bw.Write(s);
|
||||||
|
bw.Flush();
|
||||||
|
|
||||||
|
stream.Close();
|
||||||
|
client.Close();
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Âûçûâàåòñÿ Êëèåíòîì äëÿ îòïðàâêè êîìàíäû Ñåðâåðó è ïîëó÷åíèÿ îòâåòà
|
||||||
|
function SendCommandAndReceiveAnswer(s: string): string;
|
||||||
|
begin
|
||||||
|
var client := new TcpClient(servername,port);
|
||||||
|
var stream := client.GetStream();
|
||||||
|
|
||||||
|
var bw := new BinaryWriter(stream);
|
||||||
|
bw.Write(s);
|
||||||
|
bw.Flush();
|
||||||
|
|
||||||
|
var br := new BinaryReader(stream);
|
||||||
|
Result := br.ReadString();
|
||||||
|
|
||||||
|
stream.Close();
|
||||||
|
client.Close();
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
2776
TestSuite/CompilationSamples/NumLibABC.pas
Normal file
2776
TestSuite/CompilationSamples/NumLibABC.pas
Normal file
File diff suppressed because it is too large
Load diff
282
TestSuite/CompilationSamples/PABCExtensions.pas
Normal file
282
TestSuite/CompilationSamples/PABCExtensions.pas
Normal file
|
|
@ -0,0 +1,282 @@
|
||||||
|
// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
///--
|
||||||
|
unit PABCExtensions;
|
||||||
|
|
||||||
|
uses PABCSystem;
|
||||||
|
|
||||||
|
function GetCurrentLocale: string;
|
||||||
|
begin
|
||||||
|
var locale: object;
|
||||||
|
if __CONFIG__.TryGetValue('locale', locale) then
|
||||||
|
Result := locale as string
|
||||||
|
else
|
||||||
|
Result := 'ru';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetTranslation(message: string): string;
|
||||||
|
begin
|
||||||
|
var cur_locale := GetCurrentLocale();
|
||||||
|
var arr := message.Split(new string[1]('!!'), System.StringSplitOptions.None);
|
||||||
|
if (cur_locale = 'en') and (arr.Length > 1) then
|
||||||
|
Result := arr[1]
|
||||||
|
else
|
||||||
|
Result := arr[0]
|
||||||
|
end;
|
||||||
|
|
||||||
|
//{{{doc: Начало секции подпрограмм для типизированных файлов для документации }}}
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
|
//>> Подпрограммы для работы с типизированными и бестиповыми файлами # Subroutines for typed and untyped files
|
||||||
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
/// Открывает бестиповой файл и возвращает значение для инициализации файловой переменной
|
||||||
|
function OpenBinary(fname: string): file;
|
||||||
|
begin
|
||||||
|
PABCSystem.Reset(Result, fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создаёт или обнуляет бестиповой файл и возвращает значение для инициализации файловой переменной
|
||||||
|
function CreateBinary(fname: string): file;
|
||||||
|
begin
|
||||||
|
PABCSystem.Rewrite(Result, fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Открывает бестиповой файл в заданной кодировке и возвращает значение для инициализации файловой переменной
|
||||||
|
function OpenBinary(fname: string; en: Encoding): file;
|
||||||
|
begin
|
||||||
|
PABCSystem.Reset(Result, fname, en);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создаёт или обнуляет бестиповой файл в заданной кодировке и возвращает значение для инициализации файловой переменной
|
||||||
|
function CreateBinary(fname: string; en: Encoding): file;
|
||||||
|
begin
|
||||||
|
PABCSystem.Rewrite(Result, fname, en);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ContainsReferenceTypes(t: System.Type): boolean;
|
||||||
|
begin
|
||||||
|
if t.IsPrimitive then
|
||||||
|
Result := False
|
||||||
|
else if t.IsValueType then
|
||||||
|
begin
|
||||||
|
var fa := t.GetFields(System.Reflection.BindingFlags.GetField or System.Reflection.BindingFlags.Instance or System.Reflection.BindingFlags.Public or System.Reflection.BindingFlags.NonPublic);
|
||||||
|
Result := fa.Any(x->ContainsReferenceTypes(x.FieldType));
|
||||||
|
end
|
||||||
|
else Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
BAD_TYPE_IN_TYPED_FILE = 'Для типизированных файлов нельзя указывать тип элементов, являющийся ссылочным или содержащий ссылочные поля!!Typed file cannot contain elements that are references or contains fields-references';
|
||||||
|
|
||||||
|
/// Открывает типизированный файл и возвращает значение для инициализации файловой переменной
|
||||||
|
function OpenFile<T>(fname: string): file of T;
|
||||||
|
begin
|
||||||
|
if ContainsReferenceTypes(typeof(T)) then
|
||||||
|
raise new System.SystemException(GetTranslation(BAD_TYPE_IN_TYPED_FILE));
|
||||||
|
PABCSystem.Reset(Result, fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создаёт или обнуляет типизированный файл и возвращает значение для инициализации файловой переменной
|
||||||
|
function CreateFile<T>(fname: string): file of T;
|
||||||
|
begin
|
||||||
|
if ContainsReferenceTypes(typeof(T)) then
|
||||||
|
raise new System.SystemException(GetTranslation(BAD_TYPE_IN_TYPED_FILE));
|
||||||
|
var res: file of T;
|
||||||
|
PABCSystem.Rewrite(res, fname);
|
||||||
|
Result := res;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Открывает типизированный файл в заданной кодировке и возвращает значение для инициализации файловой переменной
|
||||||
|
function OpenFile<T>(fname: string; en: Encoding): file of T;
|
||||||
|
begin
|
||||||
|
if ContainsReferenceTypes(typeof(T)) then
|
||||||
|
raise new System.SystemException(GetTranslation(BAD_TYPE_IN_TYPED_FILE));
|
||||||
|
PABCSystem.Reset(Result, fname, en);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создаёт или обнуляет типизированный файл в заданной кодировке и возвращает значение для инициализации файловой переменной
|
||||||
|
function CreateFile<T>(fname: string; en: Encoding): file of T;
|
||||||
|
begin
|
||||||
|
if ContainsReferenceTypes(typeof(T)) then
|
||||||
|
raise new System.SystemException(GetTranslation(BAD_TYPE_IN_TYPED_FILE));
|
||||||
|
var res: file of T;
|
||||||
|
PABCSystem.Rewrite(res, fname, en);
|
||||||
|
Result := res;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Открывает типизированный файл целых и возвращает значение для инициализации файловой переменной
|
||||||
|
function OpenFileInteger(fname: string): file of integer;
|
||||||
|
begin
|
||||||
|
Result := OpenFile&<integer>(fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Открывает типизированный файл вещественных и возвращает значение для инициализации файловой переменной
|
||||||
|
function OpenFileReal(fname: string): file of real;
|
||||||
|
begin
|
||||||
|
Result := OpenFile&<real>(fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создаёт или обнуляет типизированный файл целых и возвращает значение для инициализации файловой переменной
|
||||||
|
function CreateFileInteger(fname: string): file of integer;
|
||||||
|
begin
|
||||||
|
Result := CreateFile&<integer>(fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создаёт или обнуляет типизированный файл вещественных и возвращает значение для инициализации файловой переменной
|
||||||
|
function CreateFileReal(fname: string): file of real;
|
||||||
|
begin
|
||||||
|
Result := CreateFile&<real>(fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Открывает типизированный файл, записывает в него последовательность элементов ss и закрывает его
|
||||||
|
procedure WriteElements<T>(fname: string; ss: sequence of T);
|
||||||
|
begin
|
||||||
|
var f := CreateFile&<T>(fname);
|
||||||
|
foreach var x in ss do
|
||||||
|
f.Write(x);
|
||||||
|
f.Close
|
||||||
|
end;
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
|
//>> Методы расширения типизированных файлов # Extension methods for typed files
|
||||||
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
/// Устанавливает текущую позицию файлового указателя в типизированном файле на элемент с номером n
|
||||||
|
function Seek<T>(Self: file of T; n: int64): file of T; extensionmethod;
|
||||||
|
begin
|
||||||
|
PABCSystem.Seek(Self, n);
|
||||||
|
Result := Self;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Считывает и возвращает следующий элемент типизированного файла
|
||||||
|
function Read<T>(Self: file of T): T; extensionmethod;
|
||||||
|
begin
|
||||||
|
PABCSystem.Read(Self, Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Считывает и возвращает два следующих элемента типизированного файла в виде кортежа
|
||||||
|
function Read2<T>(Self: file of T): (T,T); extensionmethod;
|
||||||
|
begin
|
||||||
|
var a,b: T;
|
||||||
|
PABCSystem.Read(Self, a);
|
||||||
|
PABCSystem.Read(Self, b);
|
||||||
|
Result := (a,b);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Считывает и возвращает три следующих элемента типизированного файла в виде кортежа
|
||||||
|
function Read3<T>(Self: file of T): (T,T,T); extensionmethod;
|
||||||
|
begin
|
||||||
|
var a,b,c: T;
|
||||||
|
PABCSystem.Read(Self, a);
|
||||||
|
PABCSystem.Read(Self, b);
|
||||||
|
PABCSystem.Read(Self, c);
|
||||||
|
Result := (a,b,c);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Возвращает последовательность элементов открытого типизированного файла от текущего элемента до конечного
|
||||||
|
function ReadElements<T>(Self: file of T): sequence of T; extensionmethod;
|
||||||
|
begin
|
||||||
|
while not Self.Eof do
|
||||||
|
begin
|
||||||
|
var x := Self.Read;
|
||||||
|
yield x;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Возвращает последовательность элементов открытого типизированного файла
|
||||||
|
function Elements<T>(Self: file of T): sequence of T; extensionmethod;
|
||||||
|
begin
|
||||||
|
Reset(Self); // Если файл открыт, то файловый указатель просто устанавливается на 0 позицию
|
||||||
|
Result := Self.ReadElements;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
/// Открывает типизированный файл, возвращает последовательность его элементов и закрывает его
|
||||||
|
function ReadElements<T>(fname: string): sequence of T;
|
||||||
|
begin
|
||||||
|
var f := OpenFile&<T>(fname);
|
||||||
|
while not f.Eof do
|
||||||
|
begin
|
||||||
|
var x := f.Read;
|
||||||
|
yield x;
|
||||||
|
end;
|
||||||
|
f.Close
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Записывает данные в типизированный файл
|
||||||
|
procedure Write<T>(Self: file of T; params vals: array of T); extensionmethod;
|
||||||
|
begin
|
||||||
|
foreach var x in vals do
|
||||||
|
PABCSystem.Write(Self, x);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Открывает существующий типизированный файл
|
||||||
|
procedure Reset<T>(Self: file of T); extensionmethod;
|
||||||
|
begin
|
||||||
|
PABCSystem.Reset(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создает новый или обнуляет существующий типизированный файл
|
||||||
|
procedure Rewrite<T>(Self: file of T); extensionmethod;
|
||||||
|
begin
|
||||||
|
PABCSystem.Rewrite(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
//{{{--doc: Конец секции подпрограмм для типизированных файлов для документации }}}
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
|
//>> Функции, создающие HashSet и SortedSet по встроенным множествам # Function for creation HashSet and SortedSet from set of T
|
||||||
|
// -----------------------------------------------------
|
||||||
|
|
||||||
|
{/// Создает HashSet по встроенному множеству
|
||||||
|
function HSet<T>(s: set of T): HashSet<T>;
|
||||||
|
begin
|
||||||
|
Result := new HashSet<T>;
|
||||||
|
foreach var x in s do
|
||||||
|
Result += x;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/// Создает SortedSet по встроенному множеству
|
||||||
|
function SSet<T>(s: set of T): SortedSet<T>;
|
||||||
|
begin
|
||||||
|
Result := new SortedSet<T>;
|
||||||
|
foreach var x in s do
|
||||||
|
Result += x;
|
||||||
|
end;}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Операции для procedure
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
///--
|
||||||
|
function operator*(p: procedure; n: integer): procedure; extensionmethod;
|
||||||
|
begin
|
||||||
|
Result := () -> for var i:=1 to n do p
|
||||||
|
end;
|
||||||
|
|
||||||
|
///--
|
||||||
|
function operator*(n: integer; p: procedure): procedure; extensionmethod;
|
||||||
|
begin
|
||||||
|
Result := () -> for var i:=1 to n do p
|
||||||
|
end;
|
||||||
|
|
||||||
|
var __initialized: boolean;
|
||||||
|
|
||||||
|
procedure __InitModule;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure __InitModule__;
|
||||||
|
begin
|
||||||
|
if not __initialized then
|
||||||
|
begin
|
||||||
|
__initialized := true;
|
||||||
|
__InitPABCSystem;
|
||||||
|
__InitModule;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
__InitModule;
|
||||||
|
end.
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue