diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 8aa6101e7..809db5fd6 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "8"; public const string Build = "0"; - public const string Revision = "2884"; + public const string Revision = "2886"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index abd2480bd..56fd19998 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=0 -%REVISION%=2884 +%REVISION%=2886 %MINOR%=8 %MAJOR%=3 diff --git a/NETGenerator/Helpers.cs b/NETGenerator/Helpers.cs index 3743d47fb..773293a23 100644 --- a/NETGenerator/Helpers.cs +++ b/NETGenerator/Helpers.cs @@ -657,6 +657,8 @@ namespace PascalABCCompiler.NETGenerator { public object GetConstantForExpression(IExpressionNode expr) { + if (expr is PascalABCCompiler.TreeRealization.null_const_node) // SSM 20/04/21 + return expr; if (expr is IConstantNode) return (expr as IConstantNode).value; return null; diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index cdbdbc9ef..cb1d5048e 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -2639,7 +2639,9 @@ namespace PascalABCCompiler.NETGenerator { if (default_value.GetType() != param_types[i + num] && param_types[i + num].IsEnum && (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)) default_value = Enum.ToObject(param_types[i + num], default_value); - pb.SetConstant(default_value); + if (default_value is TreeRealization.null_const_node) // SSM 20/04/21 + pb.SetConstant(null); + else pb.SetConstant(default_value); } if (func.functions_nodes.Length > 0) { @@ -6995,7 +6997,9 @@ namespace PascalABCCompiler.NETGenerator pa |= ParameterAttributes.Optional; pb = methb.DefineParameter(i + 1, pa, parameters[i].name); if (default_value != null) - pb.SetConstant(default_value); + if (default_value is TreeRealization.null_const_node) // SSM 20/04/21 + pb.SetConstant(null); + else pb.SetConstant(default_value); helper.AddParameter(parameters[i], pb); if (parameters[i].is_params) pb.SetCustomAttribute(TypeFactory.ParamArrayAttributeConstructor, new byte[] { 0x1, 0x0, 0x0, 0x0 }); @@ -7019,7 +7023,9 @@ namespace PascalABCCompiler.NETGenerator pa |= ParameterAttributes.Optional; pb = methb.DefineParameter(i + 1, pa, parameters[i].name); if (default_value != null) - pb.SetConstant(default_value); + if (default_value is TreeRealization.null_const_node) // SSM 20/04/21 + pb.SetConstant(null); + else pb.SetConstant(default_value); helper.AddParameter(parameters[i], pb); if (parameters[i].is_params) pb.SetCustomAttribute(TypeFactory.ParamArrayAttributeConstructor, new byte[] { 0x1, 0x0, 0x0, 0x0 }); diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index ed1705d6c..5e0fec179 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.8.0.2884 +3.8.0.2886 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index b3647a210..8556a793d 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.8.0.2884' +!define VERSION '3.8.0.2886' diff --git a/TestSuite/CompilationSamples/graph3d.pas b/TestSuite/CompilationSamples/graph3d.pas index 771148a5d..efabb8351 100644 --- a/TestSuite/CompilationSamples/graph3d.pas +++ b/TestSuite/CompilationSamples/graph3d.pas @@ -101,7 +101,7 @@ function P3D(x, y, z: real): Point3D; /// Возвращает 3D-вектор с координатами (x,y,z) function V3D(x, y, z: real): Vector3D; /// Возвращает 3D-размер с координатами (x,y,z) -function Sz3D(x, y, z: real): Size3D; +function Sz3D(x, y, z: real): Size3D; // ----------------------------------------------------- //>> Graph3D: функции для создания материалов Materials # Graph3D Materials functions @@ -118,6 +118,9 @@ function EmissiveMaterial(c: Color): Material; function ImageMaterial(fname: string; M: real := 1; N: real := 1): Material; /// Радужный материал function RainbowMaterial: Material; +/// Возвращает материал по умолчанию +function DefaultMaterial: Material; + type // ----------------------------------------------------- @@ -901,6 +904,8 @@ type procedure CreateBase(m: MeshElement3D; x, y, z: real; mat: GMaterial); begin CreateBase0(m, x, y, z); + if mat = nil then + mat := DefaultMaterial; m.Material := mat; //MaterialHelper.ChangeOpacity(mat,0.1); //MaterialHelper.ChangeOpacity(BackMaterial,0.1); @@ -3187,8 +3192,6 @@ type // ----------------------------------------------------- //>> Graph3D: сервисные функции # Graph3D service functions // ----------------------------------------------------- -/// Возвращает материал по умолчанию -function DefaultMaterial: Material; /// Возвращает пустую группу объектов в точке (x, y, z) function Group(x, y, z: integer): Group3D; /// Возвращает пустую группу объектов в точке p @@ -3208,9 +3211,11 @@ procedure ShowObjects; //>> Graph3D: функции для создания 3D-объектов # Graph3D functions for creation 3D-objects // ----------------------------------------------------- /// Возвращает сферу с центром в точке (x, y, z) радиуса Radius -function Sphere(x, y, z, Radius: real; m: Material := DefaultMaterial): SphereT; +function Sphere(x, y, z, Radius: real; m: Material): SphereT; +/// Возвращает сферу с центром в точке (x, y, z) радиуса Radius +function Sphere(x, y, z, Radius: real): SphereT; /// Возвращает сферу с центром в точке center радиуса Radius -function Sphere(center: Point3D; Radius: real; m: Material := DefaultMaterial): SphereT; +function Sphere(center: Point3D; Radius: real; m: Material := nil): SphereT; /// Возвращает эллипсоид с центром в точке (x, y, z) и радиусами RadiusX, RadiusY, RadiusZ function Ellipsoid(x, y, z, RadiusX, RadiusY, RadiusZ: real; m: Material := DefaultMaterial): EllipsoidT; /// Возвращает эллипсоид с центром в точке center и радиусами RadiusX, RadiusY, RadiusZ @@ -4111,6 +4116,8 @@ function Group(en: sequence of Object3D): Group3D := Inv(()->Group3D.Create(0, 0 function Sphere(x, y, z, Radius: real; m: Material): SphereT := Inv(()->SphereT.Create(x, y, z, Radius, m)); +function Sphere(x, y, z, Radius: real): SphereT := Sphere(x, y, z, Radius, DefaultMaterial); + function Sphere(center: Point3D; Radius: real; m: Material) := Sphere(center.x, center.y, center.z, Radius, m); function Ellipsoid(x, y, z, RadiusX, RadiusY, RadiusZ: real; m: Material): EllipsoidT := Inv(()->EllipsoidT.Create(x, y, z, RadiusX, RadiusY, RadiusZ, m)); diff --git a/bin/Lib/Graph3D.pas b/bin/Lib/Graph3D.pas index 771148a5d..efabb8351 100644 --- a/bin/Lib/Graph3D.pas +++ b/bin/Lib/Graph3D.pas @@ -101,7 +101,7 @@ function P3D(x, y, z: real): Point3D; /// Возвращает 3D-вектор с координатами (x,y,z) function V3D(x, y, z: real): Vector3D; /// Возвращает 3D-размер с координатами (x,y,z) -function Sz3D(x, y, z: real): Size3D; +function Sz3D(x, y, z: real): Size3D; // ----------------------------------------------------- //>> Graph3D: функции для создания материалов Materials # Graph3D Materials functions @@ -118,6 +118,9 @@ function EmissiveMaterial(c: Color): Material; function ImageMaterial(fname: string; M: real := 1; N: real := 1): Material; /// Радужный материал function RainbowMaterial: Material; +/// Возвращает материал по умолчанию +function DefaultMaterial: Material; + type // ----------------------------------------------------- @@ -901,6 +904,8 @@ type procedure CreateBase(m: MeshElement3D; x, y, z: real; mat: GMaterial); begin CreateBase0(m, x, y, z); + if mat = nil then + mat := DefaultMaterial; m.Material := mat; //MaterialHelper.ChangeOpacity(mat,0.1); //MaterialHelper.ChangeOpacity(BackMaterial,0.1); @@ -3187,8 +3192,6 @@ type // ----------------------------------------------------- //>> Graph3D: сервисные функции # Graph3D service functions // ----------------------------------------------------- -/// Возвращает материал по умолчанию -function DefaultMaterial: Material; /// Возвращает пустую группу объектов в точке (x, y, z) function Group(x, y, z: integer): Group3D; /// Возвращает пустую группу объектов в точке p @@ -3208,9 +3211,11 @@ procedure ShowObjects; //>> Graph3D: функции для создания 3D-объектов # Graph3D functions for creation 3D-objects // ----------------------------------------------------- /// Возвращает сферу с центром в точке (x, y, z) радиуса Radius -function Sphere(x, y, z, Radius: real; m: Material := DefaultMaterial): SphereT; +function Sphere(x, y, z, Radius: real; m: Material): SphereT; +/// Возвращает сферу с центром в точке (x, y, z) радиуса Radius +function Sphere(x, y, z, Radius: real): SphereT; /// Возвращает сферу с центром в точке center радиуса Radius -function Sphere(center: Point3D; Radius: real; m: Material := DefaultMaterial): SphereT; +function Sphere(center: Point3D; Radius: real; m: Material := nil): SphereT; /// Возвращает эллипсоид с центром в точке (x, y, z) и радиусами RadiusX, RadiusY, RadiusZ function Ellipsoid(x, y, z, RadiusX, RadiusY, RadiusZ: real; m: Material := DefaultMaterial): EllipsoidT; /// Возвращает эллипсоид с центром в точке center и радиусами RadiusX, RadiusY, RadiusZ @@ -4111,6 +4116,8 @@ function Group(en: sequence of Object3D): Group3D := Inv(()->Group3D.Create(0, 0 function Sphere(x, y, z, Radius: real; m: Material): SphereT := Inv(()->SphereT.Create(x, y, z, Radius, m)); +function Sphere(x, y, z, Radius: real): SphereT := Sphere(x, y, z, Radius, DefaultMaterial); + function Sphere(center: Point3D; Radius: real; m: Material) := Sphere(center.x, center.y, center.z, Radius, m); function Ellipsoid(x, y, z, RadiusX, RadiusY, RadiusZ: real; m: Material): EllipsoidT := Inv(()->EllipsoidT.Create(x, y, z, RadiusX, RadiusY, RadiusZ, m));