Merge branch 'master' of github.com:pascalabcnet/pascalabcnet
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "4";
|
||||
public const string Build = "2";
|
||||
public const string Revision = "1994";
|
||||
public const string Revision = "2003";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=4
|
||||
%REVISION%=1994
|
||||
%COREVERSION%=2
|
||||
%REVISION%=2003
|
||||
%MINOR%=4
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -9,6 +9,4 @@ begin
|
|||
Rectangle3D(0,0,-0.01,15,15,OrtZ,OrtX,ImageMaterial('трава.jpg',0.2,0.2));
|
||||
Sleep(2000);
|
||||
Lights.AddPointLight(GrayColor(64),p);
|
||||
Lights.Proba;
|
||||
//Rectangle3D(0,0,-0.01,15,15,OrtZ,OrtX,Colors.Green);
|
||||
end.
|
||||
|
|
@ -1766,7 +1766,8 @@ namespace PascalABCCompiler.NETGenerator
|
|||
//ivan
|
||||
if (ti.tp.IsEnum || !(ti.tp is TypeBuilder)) return;
|
||||
TypeBuilder tb = (TypeBuilder)ti.tp;
|
||||
if (tb.IsValueType) BuildCloseTypeOrder(value, tb);
|
||||
if (tb.IsValueType)
|
||||
BuildCloseTypeOrder(value, tb);
|
||||
//сохраняем контекст
|
||||
TypeInfo tmp_ti = cur_ti;
|
||||
cur_ti = ti;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<HTML><HEAD><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="Elements">
|
||||
<param name="Keyword" value="Read">
|
||||
<param name="Keyword" value="Read2">
|
||||
<param name="Keyword" value="Read3">
|
||||
|
|
@ -9,7 +10,9 @@
|
|||
<param name="Keyword" value="Write"></object>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><link rel="StyleSheet" href="../../../default.css">
|
||||
</HEAD><body><H1>Ìåòîäû ðàñøèðåíèÿ òèïèçèðîâàííûõ ôàéëîâ</H1>
|
||||
<table border=0 cellpadding=5><tr><td><code><b>function</b> Read<T>(Self: <b>file</b> <b>of</b> T): T;</code>
|
||||
<table border=0 cellpadding=5><tr><td><code><b>function</b> Elements<T>(Self: <b>file</b> <b>of</b> T): <b>sequence </b> <b>of</b> T;</code>
|
||||
<br> Âîçâðàùàåò ïîñëåäîâàòåëüíîñòü ýëåìåíòîâ îòêðûòîãî òèïèçèðîâàííîãî ôàéëà</td></tr>
|
||||
<tr><td><code><b>function</b> Read<T>(Self: <b>file</b> <b>of</b> T): T;</code>
|
||||
<br> Ñ÷èòûâàåò è âîçâðàùàåò ñëåäóþùèé ýëåìåíò òèïèçèðîâàííîãî ôàéëà</td></tr>
|
||||
<tr><td><code><b>function</b> Read2<T>(Self: <b>file</b> <b>of</b> T): (T,T);</code>
|
||||
<br> Ñ÷èòûâàåò è âîçâðàùàåò äâà ñëåäóþùèõ ýëåìåíòà òèïèçèðîâàííîãî ôàéëà â âèäå êîðòåæà</td></tr>
|
||||
|
|
|
|||
|
|
@ -227,5 +227,11 @@
|
|||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> newname (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code><strong>function</strong> Lines: <strong>sequence of</strong>
|
||||
string; </code><br>
|
||||
Âîçâðàùàåò ïîñëåäîâàòåëüíîñòü ñòðîê îòêðûòîãî òåêñòîâîãî ôàéëà</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body></html>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.4.2.1994'
|
||||
!define VERSION '3.4.2.2003'
|
||||
|
|
|
|||
|
|
@ -3569,7 +3569,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public void read_unnamed_type_object(unnamed_type_object _unnamed_type_object)
|
||||
{
|
||||
read_expression(_unnamed_type_object);
|
||||
read_addressed_value(_unnamed_type_object);
|
||||
_unnamed_type_object.ne_list = _read_node() as name_assign_expr_list;
|
||||
_unnamed_type_object.is_class = br.ReadBoolean();
|
||||
_unnamed_type_object.new_ex = _read_node() as new_expr;
|
||||
|
|
|
|||
|
|
@ -5500,7 +5500,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public void write_unnamed_type_object(unnamed_type_object _unnamed_type_object)
|
||||
{
|
||||
write_expression(_unnamed_type_object);
|
||||
write_addressed_value(_unnamed_type_object);
|
||||
if (_unnamed_type_object.ne_list == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
|
|
|
|||
|
|
@ -42397,9 +42397,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///Это - сахарная конструкция.
|
||||
/// Объект безымянного класса. Например: new class(Name := 'Иванов'; Age := 25);
|
||||
/// new_ex - это узел для генерации кода, основной узел предназначен для форматирования
|
||||
|
||||
/// Сделал потомком addressed_value из-за #1843
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class unnamed_type_object : expression
|
||||
public partial class unnamed_type_object : addressed_value
|
||||
{
|
||||
|
||||
///<summary>
|
||||
|
|
|
|||
|
|
@ -2558,7 +2558,7 @@
|
|||
</TagIndices>
|
||||
</Tags>
|
||||
</SyntaxNode>
|
||||
<SyntaxNode Name="unnamed_type_object" BaseName="expression">
|
||||
<SyntaxNode Name="unnamed_type_object" BaseName="addressed_value">
|
||||
<Fields>
|
||||
<SyntaxField Name="ne_list" SyntaxType="name_assign_expr_list" />
|
||||
<ExtendedField Name="is_class" Type="bool" CreateVariable="false" DeleteVariable="false" />
|
||||
|
|
@ -4398,7 +4398,7 @@
|
|||
<HelpData Key="unknown_ident.UnknownID" Value="" />
|
||||
<HelpData Key="unknown_type" Value="" />
|
||||
<HelpData Key="unknown_type.context" Value="" />
|
||||
<HelpData Key="unnamed_type_object" Value="Это - сахарная конструкция.
/// Объект безымянного класса. Например: new class(Name := 'Иванов'; Age := 25);
/// new_ex - это узел для генерации кода, основной узел предназначен для форматирования" />
|
||||
<HelpData Key="unnamed_type_object" Value="Это - сахарная конструкция.
/// Объект безымянного класса. Например: new class(Name := 'Иванов'; Age := 25);
/// new_ex - это узел для генерации кода, основной узел предназначен для форматирования

/// Сделал потомком addressed_value из-за #1843" />
|
||||
<HelpData Key="unnamed_type_object.is_class" Value="" />
|
||||
<HelpData Key="unnamed_type_object.ne" Value="" />
|
||||
<HelpData Key="unnamed_type_object.ne_list" Value="" />
|
||||
|
|
|
|||
|
|
@ -478,6 +478,11 @@ procedure AddBottomPanel(Height: real := 100; c: Color := Colors.LightGray);
|
|||
|
||||
procedure AddStatusBar(Height: real := 24);}
|
||||
|
||||
{function GetDC: DrawingContext;
|
||||
procedure ReleaseDC(dc: DrawingContext);
|
||||
procedure FastDraw(d: DrawingContext->());
|
||||
procedure FastClear(var dc: DrawingContext);}
|
||||
|
||||
procedure __InitModule__;
|
||||
procedure __FinalizeModule__;
|
||||
|
||||
|
|
@ -551,6 +556,23 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure FastDraw(d: DrawingContext->());
|
||||
begin
|
||||
Invoke(()->
|
||||
begin
|
||||
var dc := GetDC;
|
||||
d(dc);
|
||||
ReleaseDC(dc);
|
||||
end);
|
||||
end;
|
||||
|
||||
procedure FastClear(var dc: DrawingContext);
|
||||
begin
|
||||
ReleaseDC(dc);
|
||||
Window.Clear;
|
||||
dc := GetDC;
|
||||
end;
|
||||
|
||||
function GetDC(t: Transform): DrawingContext;
|
||||
begin
|
||||
var visual := new DrawingVisual();
|
||||
|
|
@ -1313,7 +1335,6 @@ begin
|
|||
FillRectangle(0,0,Window.Width,Window.Height,c)
|
||||
end;
|
||||
|
||||
|
||||
procedure WindowTypeWPF.Clear := Invoke(WindowTypeClearP);
|
||||
|
||||
procedure WindowTypeWPF.Clear(c: Color) := Invoke(WindowTypeClearPC,c);
|
||||
|
|
|
|||
|
|
@ -409,6 +409,8 @@ type
|
|||
procedure Append;
|
||||
/// Открывает текстовый файл на дополнение в указанной кодировке
|
||||
procedure Append(en: Encoding);
|
||||
/// Возвращает последовательность строк открытого текстового файла
|
||||
function Lines: sequence of string;
|
||||
end;
|
||||
|
||||
/// Тип текстового файла
|
||||
|
|
@ -5607,6 +5609,14 @@ procedure Text.Append := PABCSystem.Append(Self);
|
|||
|
||||
procedure Text.Append(en: Encoding) := PABCSystem.Append(Self,en);
|
||||
|
||||
function Text.Lines: sequence of string;
|
||||
begin
|
||||
Self.sr.BaseStream.Position := 0;
|
||||
while not Eof do
|
||||
yield ReadlnString;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------
|
||||
// AbstractBinaryFile methods
|
||||
|
|
@ -8653,8 +8663,6 @@ function MinBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensionmet
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((min, x)-> comp.Compare(selector(x), selector(min)) < 0 ? x : min);
|
||||
|
|
@ -8665,8 +8673,6 @@ function MaxBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensionmet
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((max, x)-> comp.Compare(selector(x), selector(max)) > 0 ? x : max);
|
||||
|
|
@ -8677,8 +8683,6 @@ function LastMinBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensio
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((min, x)-> comp.Compare(selector(x), selector(min)) <= 0 ? x : min);
|
||||
|
|
@ -8689,8 +8693,6 @@ function LastMaxBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensio
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((max, x)-> comp.Compare(selector(x), selector(max)) >= 0 ? x : max);
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ procedure Put(param: boolean);
|
|||
procedure Put(param: PNode);
|
||||
procedure Put(param: Node);
|
||||
|
||||
{
|
||||
|
||||
//Ввод этих данных не поддерживается
|
||||
///- read(a,b,...)
|
||||
/// Вводит значения a,b,... из окна электронного задачника
|
||||
|
|
@ -447,7 +447,6 @@ procedure Read(var val: Node);
|
|||
procedure Read(var val: PNode);
|
||||
///--
|
||||
procedure Readln;
|
||||
}
|
||||
|
||||
procedure Print(params args: array of object);
|
||||
procedure Println(params args: array of object);
|
||||
|
|
|
|||
|
|
@ -757,7 +757,8 @@ type
|
|||
Group3D = class(ObjectWithChildren3D)
|
||||
protected
|
||||
function CreateObject: Object3D; override := new Group3D(X, Y, Z);
|
||||
public
|
||||
//public
|
||||
protected
|
||||
constructor(x, y, z: real) := CreateBase0(new ModelVisual3D, x, y, z);
|
||||
|
||||
constructor(x, y, z: real; lst: sequence of Object3D);
|
||||
|
|
|
|||
5
TestSuite/Set_char_string.pas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
begin
|
||||
var s: set of string := ['b','d '];
|
||||
foreach var o in s do
|
||||
Assert(o.GetType = typeof(string));
|
||||
end.
|
||||
|
|
@ -410,7 +410,7 @@ procedure Put(param: boolean);
|
|||
procedure Put(param: PNode);
|
||||
procedure Put(param: Node);
|
||||
|
||||
{
|
||||
|
||||
//Ввод этих данных не поддерживается
|
||||
///- read(a,b,...)
|
||||
/// Вводит значения a,b,... из окна электронного задачника
|
||||
|
|
@ -447,7 +447,6 @@ procedure Read(var val: Node);
|
|||
procedure Read(var val: PNode);
|
||||
///--
|
||||
procedure Readln;
|
||||
}
|
||||
|
||||
procedure Print(params args: array of object);
|
||||
procedure Println(params args: array of object);
|
||||
|
|
|
|||
|
|
@ -4842,8 +4842,6 @@ namespace PascalABCCompiler.TreeConverter
|
|||
types.AddElement(en.type);
|
||||
}
|
||||
}
|
||||
expressions_list consts_copy = new expressions_list();
|
||||
consts_copy.AddRange(consts);
|
||||
type_node ctn = null;
|
||||
if (consts.Count > 0)
|
||||
{
|
||||
|
|
@ -4855,7 +4853,22 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
}
|
||||
else ctn = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
|
||||
|
||||
/*if (el_type == SystemLibrary.SystemLibrary.string_type)
|
||||
{
|
||||
for (int i = 0; i < consts.Count; i++)
|
||||
if (consts[i].type == SystemLibrary.SystemLibrary.char_type)
|
||||
{
|
||||
consts[i] = convertion_data_and_alghoritms.convert_type(consts[i], el_type);
|
||||
}
|
||||
} */ // Не работает ! SSM 19.03.19
|
||||
|
||||
expressions_list consts_copy = new expressions_list();
|
||||
consts_copy.AddRange(consts);
|
||||
|
||||
function_node fn = convertion_data_and_alghoritms.select_function(consts, SystemLibrary.SystemLibInitializer.CreateSetProcedure.SymbolInfo, (SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info is common_namespace_function_node)?(SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info as common_namespace_function_node).loc:null);
|
||||
|
||||
|
||||
if (fn is common_namespace_function_node)
|
||||
{
|
||||
common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, get_location(_pascal_set_constant));
|
||||
|
|
@ -17458,7 +17471,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (tn == null || tn is null_type_node || tn.ImplementingInterfaces == null)
|
||||
return false;
|
||||
|
||||
if (tn.element_type != null) // еще может быть множество set of T - 22.02.16 SSM
|
||||
if (tn.element_type != null && tn.type_special_kind != SemanticTree.type_special_kind.typed_file) // еще может быть множество set of T - 22.02.16 SSM
|
||||
{
|
||||
elem_type = tn.element_type;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VisualPascalABC</RootNamespace>
|
||||
<AssemblyName>PascalABCNET</AssemblyName>
|
||||
<ApplicationIcon>ABCNET32.ico</ApplicationIcon>
|
||||
<ApplicationIcon>_ABC13.ico</ApplicationIcon>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
|
|
@ -668,6 +668,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ABCNET32.ico" />
|
||||
<Content Include="_ABC13.ico" />
|
||||
<None Include="Resources\AlignObjectsBottomHS.png" />
|
||||
<None Include="Resources\AlignObjectsCenteredHorizontalHS.png" />
|
||||
<None Include="Resources\AlignObjectsCenteredVerticalHS.png" />
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VisualPascalABC</RootNamespace>
|
||||
<AssemblyName>PascalABCNET</AssemblyName>
|
||||
<ApplicationIcon>ABCNET32.ico</ApplicationIcon>
|
||||
<ApplicationIcon>_ABC13.ico</ApplicationIcon>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
|
|
@ -73,6 +73,7 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
BIN
VisualPascalABCNET/_ABC13.ico
Normal file
|
After Width: | Height: | Size: 42 KiB |
150
_NewAppIcons/ABC_NET3.svg
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
viewBox="0 0 210 297"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"
|
||||
sodipodi:docname="ABC_NET3.svg"
|
||||
inkscape:export-filename="D:\ABC_NET.png"
|
||||
inkscape:export-xdpi="16.785793"
|
||||
inkscape:export-ydpi="16.785793">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.979899"
|
||||
inkscape:cx="410.74107"
|
||||
inkscape:cy="761.56319"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2035"
|
||||
inkscape:window-x="-13"
|
||||
inkscape:window-y="-13"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#800080;stroke-width:2.68302298;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect4551"
|
||||
width="94.160774"
|
||||
height="94.160774"
|
||||
x="34.971359"
|
||||
y="50.803802"
|
||||
inkscape:export-filename="D:\rect4551.png"
|
||||
inkscape:export-xdpi="268.57269"
|
||||
inkscape:export-ydpi="268.57269" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.79999924px;line-height:1.25;font-family:AcademyC;-inkscape-font-specification:AcademyC;letter-spacing:0px;word-spacing:0px;fill:#00008c;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
|
||||
x="42.522709"
|
||||
y="92.53344"
|
||||
id="text12"
|
||||
inkscape:export-filename="D:\rect4551.png"
|
||||
inkscape:export-xdpi="268.57269"
|
||||
inkscape:export-ydpi="268.57269"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan10"
|
||||
x="42.522709"
|
||||
y="92.53344"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:52.21111298px;font-family:AcademyC;-inkscape-font-specification:'AcademyC Bold';fill:#00008c;fill-opacity:1;stroke-width:0.26458332;">A</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:52.9131279px;line-height:1.25;font-family:AcademyC;-inkscape-font-specification:AcademyC;letter-spacing:0px;word-spacing:0px;fill:#008000;fill-opacity:1;stroke:none;stroke-width:0.27558917;"
|
||||
x="83.462227"
|
||||
y="96.382545"
|
||||
id="text4528"
|
||||
inkscape:export-filename="D:\rect4551.png"
|
||||
inkscape:export-xdpi="268.57269"
|
||||
inkscape:export-ydpi="268.57269"
|
||||
transform="scale(1.041597,0.96006422)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4526"
|
||||
x="83.462227"
|
||||
y="96.382545"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:55.11783981px;font-family:AcademyC;-inkscape-font-specification:'AcademyC Bold';fill:#008000;fill-opacity:1;stroke-width:0.27558917;">B</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.51227951px;line-height:1.25;font-family:AcademyC;-inkscape-font-specification:AcademyC;letter-spacing:0px;word-spacing:0px;fill:#fe0000;fill-opacity:1;stroke:none;stroke-width:0.26829311"
|
||||
x="62.139774"
|
||||
y="133.48834"
|
||||
id="text4532"
|
||||
inkscape:export-filename="D:\rect4551.png"
|
||||
inkscape:export-xdpi="268.57269"
|
||||
inkscape:export-ydpi="268.57269"
|
||||
transform="scale(1.0140212,0.98617267)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4530"
|
||||
x="62.139774"
|
||||
y="133.48834"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:53.65862656px;font-family:AcademyC;-inkscape-font-specification:'AcademyC Bold';fill:#fe0000;fill-opacity:1;stroke-width:0.26829311">C</tspan></text>
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.85057938;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect823"
|
||||
width="18.174326"
|
||||
height="14.29892"
|
||||
x="84.85807"
|
||||
y="123.40845" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:47.02330017px;line-height:1.25;font-family:'Century Schoolbook';-inkscape-font-specification:'Century Schoolbook Bold';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.48982599"
|
||||
x="45.19812"
|
||||
y="141.88565"
|
||||
id="text4544"
|
||||
transform="scale(1.0078482,0.99221293)"
|
||||
inkscape:export-filename="D:\rect4551.png"
|
||||
inkscape:export-xdpi="268.57269"
|
||||
inkscape:export-ydpi="268.57269"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4542"
|
||||
x="45.19812"
|
||||
y="141.88565"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:1.25;font-family:'Century Schoolbook';-inkscape-font-specification:'Century Schoolbook Bold';stroke-width:0.48982599">net</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.45018005px;line-height:1.25;font-family:'Javanese Text';-inkscape-font-specification:'Javanese Text';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.52552265"
|
||||
x="33.063255"
|
||||
y="145.56998"
|
||||
id="text4544-6"
|
||||
transform="scale(1.0346912,0.96647193)"
|
||||
inkscape:export-filename="D:\rect4551.png"
|
||||
inkscape:export-xdpi="268.57269"
|
||||
inkscape:export-ydpi="268.57269"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4542-4"
|
||||
x="33.063255"
|
||||
y="145.56998"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:1.25;font-family:'Javanese Text';-inkscape-font-specification:'Javanese Text';stroke-width:0.52552265">.</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.8 KiB |
BIN
_NewAppIcons/_ABC10.ico
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
_NewAppIcons/_ABC13.ico
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
_NewAppIcons/_copy.ico
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
_NewAppIcons/_cut.ico
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
_NewAppIcons/_format.ico
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
_NewAppIcons/_help.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
_NewAppIcons/_new.ico
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
_NewAppIcons/_open.ico
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
_NewAppIcons/_options.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
_NewAppIcons/_paste.ico
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
_NewAppIcons/_redo.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
_NewAppIcons/_run.ico
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
_NewAppIcons/_save.ico
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
_NewAppIcons/_undo.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -77,23 +77,31 @@ type
|
|||
TextLabelT = class(CommonControl)
|
||||
protected
|
||||
function b: GTextBlock := element as GTextBlock;
|
||||
function GetText: string := InvokeString(()->b.Text);
|
||||
procedure SetTextP(t: string) := b.Text := t;
|
||||
procedure SetText(t: string) := Invoke(SetTextP,t);
|
||||
procedure CreateP(Txt: string);
|
||||
begin
|
||||
element := new GTextBlock;
|
||||
var tb := new GTextBlock;
|
||||
element := tb;
|
||||
//element.Margin := new Thickness(0,0,0,8);
|
||||
//element.Margin := new Thickness(5,5,5,0);
|
||||
Text := Txt;
|
||||
ActivePanel.Children.Add(b);
|
||||
end;
|
||||
public
|
||||
constructor Create(Txt: string);
|
||||
procedure CreatePXY(x,y: real; Txt: string);
|
||||
begin
|
||||
Invoke(CreateP,Txt);
|
||||
var tb := new GTextBlock;
|
||||
element := tb;
|
||||
tb.Background := new SolidColorBrush(Colors.White);
|
||||
tb.FontSize := 20;
|
||||
tb.Opacity := 0.7;
|
||||
Canvas.SetLeft(element,x);
|
||||
Canvas.SetTop(element,y);
|
||||
Text := Txt;
|
||||
ActivePanel.Children.Add(b);
|
||||
end;
|
||||
property Text: string read GetText write SetText;
|
||||
public
|
||||
constructor Create(Txt: string) := Invoke(CreateP,Txt);
|
||||
constructor Create(x,y: real; Txt: string) := Invoke(CreatePXY,x,y,Txt);
|
||||
property Text: string read InvokeString(()->b.Text) write Invoke(procedure(t: string) -> b.Text := t,value);
|
||||
end;
|
||||
|
||||
///!#
|
||||
|
|
@ -241,16 +249,18 @@ type
|
|||
end;
|
||||
|
||||
|
||||
function Button(Txt: string): ButtonT;
|
||||
function TextLabel(Txt: string): TextLabelT;
|
||||
function TextBox(Txt: string := ''; w: real := 0): TextBoxT;
|
||||
function IntegerBox(w: real := 0): IntegerBoxT;
|
||||
function Slider(min: real := 0; max: real := 10; val: real := 0): SliderT;
|
||||
|
||||
procedure EmptyBlock(sz: integer := 16);
|
||||
function Button(Txt: string): ButtonT;
|
||||
function TextLabel(Txt: string): TextLabelT;
|
||||
function TextLabel(x,y: real; Txt: string): TextLabelT;
|
||||
function TextBox(Txt: string := ''; w: real := 0): TextBoxT;
|
||||
function IntegerBox(w: real := 0): IntegerBoxT;
|
||||
function Slider(min: real := 0; max: real := 10; val: real := 0): SliderT;
|
||||
|
||||
procedure EmptyBlock(sz: integer := 16);
|
||||
|
||||
implementation
|
||||
|
||||
uses GraphWPF;
|
||||
uses System.Windows;
|
||||
uses System.Windows.Controls;
|
||||
uses System.Windows.Controls.Primitives;
|
||||
|
|
@ -314,6 +324,7 @@ procedure AddStatusBar(Height: real) := Invoke(AddStatusBarP,Height);
|
|||
|
||||
function Button(Txt: string): ButtonT := ButtonT.Create(Txt);
|
||||
function TextLabel(Txt: string): TextLabelT := TextLabelT.Create(Txt);
|
||||
function TextLabel(x,y: real; Txt: string): TextLabelT := TextLabelT.Create(x,y,Txt);
|
||||
function TextBox(Txt: string; w: real): TextBoxT := TextBoxT.Create(Txt,w);
|
||||
function IntegerBox(w: real): IntegerBoxT := IntegerBoxT.Create(w);
|
||||
function Slider(min,max,val: real): SliderT := SliderT.Create(min,max,val);
|
||||
|
|
@ -325,6 +336,11 @@ begin
|
|||
e.Width:= sz;
|
||||
end;
|
||||
|
||||
procedure SetActivePanelInit;
|
||||
begin
|
||||
ActivePanel := MainWindow.MainPanel.Children[0] as Panel
|
||||
end;
|
||||
|
||||
begin
|
||||
Invoke(SetActivePanelInit);
|
||||
end.
|
||||
|
|
@ -478,6 +478,11 @@ procedure AddBottomPanel(Height: real := 100; c: Color := Colors.LightGray);
|
|||
|
||||
procedure AddStatusBar(Height: real := 24);}
|
||||
|
||||
{function GetDC: DrawingContext;
|
||||
procedure ReleaseDC(dc: DrawingContext);
|
||||
procedure FastDraw(d: DrawingContext->());
|
||||
procedure FastClear(var dc: DrawingContext);}
|
||||
|
||||
procedure __InitModule__;
|
||||
procedure __FinalizeModule__;
|
||||
|
||||
|
|
@ -551,6 +556,23 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure FastDraw(d: DrawingContext->());
|
||||
begin
|
||||
Invoke(()->
|
||||
begin
|
||||
var dc := GetDC;
|
||||
d(dc);
|
||||
ReleaseDC(dc);
|
||||
end);
|
||||
end;
|
||||
|
||||
procedure FastClear(var dc: DrawingContext);
|
||||
begin
|
||||
ReleaseDC(dc);
|
||||
Window.Clear;
|
||||
dc := GetDC;
|
||||
end;
|
||||
|
||||
function GetDC(t: Transform): DrawingContext;
|
||||
begin
|
||||
var visual := new DrawingVisual();
|
||||
|
|
@ -1313,7 +1335,6 @@ begin
|
|||
FillRectangle(0,0,Window.Width,Window.Height,c)
|
||||
end;
|
||||
|
||||
|
||||
procedure WindowTypeWPF.Clear := Invoke(WindowTypeClearP);
|
||||
|
||||
procedure WindowTypeWPF.Clear(c: Color) := Invoke(WindowTypeClearPC,c);
|
||||
|
|
|
|||
|
|
@ -142,6 +142,14 @@ begin
|
|||
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
|
||||
|
|
|
|||
|
|
@ -409,6 +409,8 @@ type
|
|||
procedure Append;
|
||||
/// Открывает текстовый файл на дополнение в указанной кодировке
|
||||
procedure Append(en: Encoding);
|
||||
/// Возвращает последовательность строк открытого текстового файла
|
||||
function Lines: sequence of string;
|
||||
end;
|
||||
|
||||
/// Тип текстового файла
|
||||
|
|
@ -3029,7 +3031,7 @@ begin
|
|||
Result.high := high;
|
||||
end;
|
||||
|
||||
[System.Diagnostics.DebuggerStepThrough]
|
||||
//[System.Diagnostics.DebuggerStepThrough]
|
||||
function CreateObjDiapason(low, high: object): Diapason;
|
||||
begin
|
||||
Result.clow := low;
|
||||
|
|
@ -3039,9 +3041,39 @@ end;
|
|||
[System.Diagnostics.DebuggerStepThrough]
|
||||
function CreateSet(params elems: array of object): TypedSet;
|
||||
begin
|
||||
var chars := false;
|
||||
var strings := false;
|
||||
var others := false;
|
||||
foreach var x in elems do
|
||||
begin
|
||||
if (x is char) or (x is Diapason) and (Diapason(x).clow is char) then
|
||||
chars := true
|
||||
else if x is string then
|
||||
strings := true
|
||||
else
|
||||
begin
|
||||
others := true;
|
||||
break
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := new TypedSet();
|
||||
for var i := 0 to elems.Length - 1 do
|
||||
Result.IncludeElement(elems[i]);
|
||||
|
||||
if chars and strings and not others then
|
||||
foreach var x in elems do
|
||||
if x is char then
|
||||
Result.IncludeElement(x.ToString)
|
||||
else if (x is Diapason) and (Diapason(x).clow is char) then
|
||||
begin
|
||||
var c1 := char(Diapason(x).clow);
|
||||
var c2 := char(Diapason(x).chigh);
|
||||
for var cc := c1 to c2 do
|
||||
Result.IncludeElement(cc.ToString)
|
||||
end
|
||||
else Result.IncludeElement(x)
|
||||
else
|
||||
foreach var x in elems do
|
||||
Result.IncludeElement(x);
|
||||
end;
|
||||
|
||||
[System.Diagnostics.DebuggerStepThrough]
|
||||
|
|
@ -5607,6 +5639,14 @@ procedure Text.Append := PABCSystem.Append(Self);
|
|||
|
||||
procedure Text.Append(en: Encoding) := PABCSystem.Append(Self,en);
|
||||
|
||||
function Text.Lines: sequence of string;
|
||||
begin
|
||||
Self.sr.BaseStream.Position := 0;
|
||||
while not Eof do
|
||||
yield ReadlnString;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------
|
||||
// AbstractBinaryFile methods
|
||||
|
|
@ -8653,8 +8693,6 @@ function MinBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensionmet
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((min, x)-> comp.Compare(selector(x), selector(min)) < 0 ? x : min);
|
||||
|
|
@ -8665,8 +8703,6 @@ function MaxBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensionmet
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((max, x)-> comp.Compare(selector(x), selector(max)) > 0 ? x : max);
|
||||
|
|
@ -8677,8 +8713,6 @@ function LastMinBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensio
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((min, x)-> comp.Compare(selector(x), selector(min)) <= 0 ? x : min);
|
||||
|
|
@ -8689,8 +8723,6 @@ function LastMaxBy<T, TKey>(Self: sequence of T; selector: T->TKey): T; extensio
|
|||
begin
|
||||
if selector = nil then
|
||||
raise new ArgumentNullException('selector');
|
||||
if not Self.Any() then
|
||||
raise new InvalidOperationException('Empty sequence');
|
||||
|
||||
var comp := Comparer&<TKey>.Default;
|
||||
Result := Self.Aggregate((max, x)-> comp.Compare(selector(x), selector(max)) >= 0 ? x : max);
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ procedure Put(param: boolean);
|
|||
procedure Put(param: PNode);
|
||||
procedure Put(param: Node);
|
||||
|
||||
{
|
||||
|
||||
//Ввод этих данных не поддерживается
|
||||
///- read(a,b,...)
|
||||
/// Вводит значения a,b,... из окна электронного задачника
|
||||
|
|
@ -447,7 +447,6 @@ procedure Read(var val: Node);
|
|||
procedure Read(var val: PNode);
|
||||
///--
|
||||
procedure Readln;
|
||||
}
|
||||
|
||||
procedure Print(params args: array of object);
|
||||
procedure Println(params args: array of object);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ ERROR_PARSERS_NOT_FOUND=Error: Parsers not found!
|
|||
CONNECTED_PARSERS=Connected parsers:
|
||||
CONNECTED_CONVERSIONS=Connected conversions:
|
||||
STARTING=Starting...
|
||||
COMMANDLINEISABSENT=Command line is absent
|
||||
FILEISABSENT{0}=File {0} is absent
|
||||
COMMANDLINEISABSENT=Command line is empty
|
||||
FILEISABSENT{0}=File {0} not found
|
||||
COMPILEERRORS=Compile errors:
|
||||
|
||||
HELP=16LINES
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ CONNECTED_PARSERS=Подключены парсеры:
|
|||
CONNECTED_CONVERSIONS=Подключены преобразования:
|
||||
STARTING=Запуск...
|
||||
COMMANDLINEISABSENT=Отсутствует командная строка
|
||||
FILEISABSENT{0}=Отсутствует файл {0}
|
||||
FILEISABSENT{0}=Файл {0} не найден
|
||||
COMPILEERRORS=Ошибки компиляции:
|
||||
|
||||
HELP=17LINES
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7=Количество элементов
|
|||
TWO_NILS_IN_QUESTION_EXPR=Условное выражение не может содержать константы nil по обеим веткам
|
||||
DOT_QUECTION_IN_SHORT_FUN=Выражение с ?. не может фигурировать в коротком определении функции без возвращаемого значения
|
||||
BAD_INT2=Слишком маленькое целое
|
||||
INVALID_INTERFACE_MEMBER=Члены интерфейса не могут иметь определение
|
||||
INVALID_INTERFACE_MEMBER=Интерфейсы не могут содержать поля и реализацию методов
|
||||
EXTENDED_INDEXED_PROPERTIES=Индексные свойства не могут быть расширенными
|
||||
TWO_STRING_LITERALS_IN_SUCCESSION=Две литеральные строковые константы не могут стоять подряд
|
||||
ATTRIBUTE_REDECLARED=Повторное применение атрибута
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ TEMPLATE_ARGUMENTS_COUNT_MISMATCH=Неправильное число парам
|
|||
TEMPLATE_PARAMETER_{0}_REDEFINITION=Повторное описание параметра {0}
|
||||
INHERITED_CONSTRUCTOR_CALL_MUST_BE_FIRST=Вызов конструктора предка должен быть первым в теле конструктора
|
||||
INHERITED_CONSTRUCTOR_CALL_EXPECTED=Необходимо вызвать конструктор предка
|
||||
INVALID_INTERFACE_MEMBER=Члены интерфейса не могут иметь поля, константы и реализацию методов
|
||||
INVALID_INTERFACE_MEMBER=Интерфейсы не могут содержать поля и реализацию методов
|
||||
{0}_IS_NOT_INTERFACE={0} не является интерфейсом
|
||||
INTERFACE_FUNCTION_WITH_BODY=Нельзя определять тело функции или процедуры интерфейса
|
||||
CONSTRUCTOR_IN_INTERFACE=Интерфейс не может содержать конструкторы
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ Var_{0}_is_already_defined=Переменная {0} уже определена
|
|||
|
||||
?._CANNOT_BE_IN_THIS_CONTEXT=Операция ?. не может располагаться в этом контексте
|
||||
|
||||
INVALID_INTERFACE_MEMBER=Члены интерфейса не могут иметь определение
|
||||
INVALID_INTERFACE_MEMBER=Интерфейсы не могут содержать поля и реализацию методов
|
||||
INDEXED_AUTO_PROPERTY=Автосвойства не могут быть индексными
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
using System;
|
||||
using PascalABCCompiler.Errors;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PascalABCCompiler
|
||||
|
|
@ -38,8 +39,77 @@ namespace PascalABCCompiler
|
|||
}
|
||||
}
|
||||
|
||||
public static bool CheckAndSplitDirective(string directive, out string name, out string value)
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(directive[0] == '/');
|
||||
directive = directive.Remove(0, 1);
|
||||
|
||||
name = null;
|
||||
value = null;
|
||||
var ss = directive.Split(':');
|
||||
if (ss.Length>2)
|
||||
{
|
||||
Console.WriteLine("Directive can contain only one ':' sign");
|
||||
return false;
|
||||
}
|
||||
name = ss[0].ToLower();
|
||||
if (ss.Length > 1)
|
||||
value = ss[1].ToLower();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ApplyDirective(string name, string value, CompilerOptions co)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "debug":
|
||||
switch (value)
|
||||
{
|
||||
case "0":
|
||||
co.Debug = false;
|
||||
co.Optimise = true;
|
||||
return true;
|
||||
case "1":
|
||||
co.Debug = true;
|
||||
return true;
|
||||
default:
|
||||
Console.WriteLine("Bad value in 'Debug' directive '{0}'. Acceptable values are 0 or 1", value);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
Console.WriteLine("No such directive name: '{0}'", name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckAndApplyDirective(string directive, CompilerOptions co)
|
||||
{
|
||||
string name, value;
|
||||
var b = CheckAndSplitDirective(directive,out name, out value);
|
||||
if (!b)
|
||||
return false;
|
||||
|
||||
b = ApplyDirective(name, value, co);
|
||||
return b;
|
||||
}
|
||||
|
||||
public static void OutputHelp()
|
||||
{
|
||||
Console.WriteLine("Command line: ");
|
||||
Console.WriteLine("pabcnetcclear /directive1:value1 /directive2:value2 ... [inputfile]\n");
|
||||
Console.WriteLine("Available directives:\n /Help /H /?\n /Debug:0(1)\n");
|
||||
Console.WriteLine("/Debug:0 generates code with all .NET optimizations!");
|
||||
}
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
// SSM 18.03.19 Делаю параметры командной строки. Формат: pabcnetc.exe /Dir1=value1 /Dir2=value2 ... fname dir
|
||||
// dir - это пережиток старого - так можно было задавать каталог раньше. Пока - увы - пусть останется
|
||||
// Пока сделаю только директивы /Help /H /? и /Debug=0(1)
|
||||
// Имя директивы - это одно слово. Равенства может не быть - тогда value директивы равно null
|
||||
// Вычленяем первое равенство и делим директиву: до него - name, после него - value. Если name или value - пустые строки, то ошибка
|
||||
|
||||
DateTime ldt = DateTime.Now;
|
||||
PascalABCCompiler.StringResourcesLanguage.LoadDefaultConfig();
|
||||
|
||||
|
|
@ -47,33 +117,72 @@ namespace PascalABCCompiler
|
|||
StringResourcesLanguage.CurrentLanguageName = StringResourcesLanguage.AccessibleLanguages[0];
|
||||
//Console.WriteLine("OK {0}ms", (DateTime.Now - ldt).TotalMilliseconds);
|
||||
ldt = DateTime.Now;
|
||||
|
||||
|
||||
//ShowConnectedParsers();
|
||||
|
||||
if (args.Length == 0)
|
||||
var n = args.Length;
|
||||
if (n == 0)
|
||||
{
|
||||
Console.WriteLine(StringResourcesGet("COMMANDLINEISABSENT"));
|
||||
//Console.WriteLine(StringResourcesGet("COMMANDLINEISABSENT"));
|
||||
OutputHelp();
|
||||
return 2;
|
||||
}
|
||||
|
||||
FileName = args[0];
|
||||
var n1 = args.TakeWhile(a => a[0] == '/').Count(); // количество директив
|
||||
|
||||
if (n1<n-2)
|
||||
{
|
||||
Console.WriteLine("Error in argument {0}", args[n1+2]);
|
||||
Console.WriteLine("Command line cannot contain any arguments after filename '{0}' and outdirname '{1}'", args[n1], args[n1 + 1]);
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (n1 == n) // только директивы
|
||||
{
|
||||
string name, value;
|
||||
var b = CheckAndSplitDirective(args[0], out name, out value);
|
||||
if (!b) // Сообщение уже будет выдано
|
||||
return 4;
|
||||
switch (name)
|
||||
{
|
||||
case "help":
|
||||
case "h":
|
||||
case "?":
|
||||
OutputHelp();
|
||||
return 0;
|
||||
default:
|
||||
Console.WriteLine("Filename is absent. Nothing to compile");
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
FileName = args[n1]; // следующий аргумент за директивами - имя файла
|
||||
if (!File.Exists(FileName))
|
||||
{
|
||||
Console.WriteLine(StringResourcesGet("FILEISABSENT{0}"),FileName);
|
||||
Console.WriteLine(StringResourcesGet("FILEISABSENT{0}"), "'" + FileName + "'");
|
||||
return 3;
|
||||
}
|
||||
|
||||
outputType = CompilerOptions.OutputType.ConsoleApplicaton;
|
||||
|
||||
CompilerOptions co = new CompilerOptions(FileName, outputType);
|
||||
if (FileName.ToLower().EndsWith(".pabcproj"))
|
||||
co.ProjectCompiled = true;
|
||||
if (args.Length==1)
|
||||
if (n1 == n - 1)
|
||||
co.OutputDirectory = "";
|
||||
else co.OutputDirectory = args[1];
|
||||
else co.OutputDirectory = args[n - 1];
|
||||
co.Rebuild = false;
|
||||
co.Debug = true;
|
||||
co.Debug = false;
|
||||
co.UseDllForSystemUnits = false;
|
||||
|
||||
for (var i = 0; i < n1; i++)
|
||||
{
|
||||
var b = CheckAndApplyDirective(args[i], co);
|
||||
if (!b)
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
bool success = true;
|
||||
if (Compiler.Compile(co) != null)
|
||||
Console.WriteLine("OK");
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>a.pas</StartArguments>
|
||||
<StartArguments>d:\a.pas</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
|
|
|
|||