From efc78fc1615010e13dcf22df85fdb63db34d5167 Mon Sep 17 00:00:00 2001
From: Timothy Nunnink <46979634+tnunnink@users.noreply.github.com>
Date: Mon, 27 Nov 2023 15:19:02 -0600
Subject: [PATCH] Finishing updates to instruction and block for now. I know
there are limitations with the referencing logic, but am going to kick fixing
these down the road in favor of pushing new release to start consuming and
finding issues.
---
src/.idea/.idea.L5Sharp/.idea/workspace.xml | 129 +-
src/L5Sharp/Common/CrossReference.cs | 20 +-
src/L5Sharp/Common/Instruction.cs | 1070 ++++++++++++-----
src/L5Sharp/Common/NeutralText.cs | 8 +
src/L5Sharp/Elements/Block.cs | 98 +-
src/L5Sharp/Elements/Line.cs | 32 +-
src/L5Sharp/Elements/Rung.cs | 6 +-
.../L5Sharp.Tests/Common/InstructionTests.cs | 211 ++--
.../L5Sharp.Tests/Common/NeutralTextTests.cs | 22 +-
tests/L5Sharp.Tests/ProofTesting.cs | 38 +-
10 files changed, 1062 insertions(+), 572 deletions(-)
diff --git a/src/.idea/.idea.L5Sharp/.idea/workspace.xml b/src/.idea/.idea.L5Sharp/.idea/workspace.xml
index 9f5982d4..f67ec986 100644
--- a/src/.idea/.idea.L5Sharp/.idea/workspace.xml
+++ b/src/.idea/.idea.L5Sharp/.idea/workspace.xml
@@ -9,48 +9,15 @@
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -94,7 +61,11 @@
+
+
+
+
@@ -117,38 +88,38 @@
- {
- "keyToString": {
- "Notification.DisplayName-DoNotAsk-Plugin Error": "Plugins failed to load",
- "Notification.DoNotAsk-Plugin Error": "true",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "TODO_SCOPE": "All Places",
- "WebServerToolWindowFactoryState": "false",
- "a7604713-2340-41ef-8914-9a0e821f9675.executor": "Debug",
- "bb4529a5-d289-453a-84c6-89ce8148c18f.executor": "Debug",
- "git-widget-placeholder": "main",
- "ignore.virus.scanning.warn.message": "true",
- "last_opened_file_path": "C:/Users/tnunnink/Documents/GitHub/L5Sharp/src/L5Sharp.sln",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "preferences.pluginManager",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
C:\Users\tnunnink\AppData\Roaming\Subversion
@@ -399,7 +370,8 @@
-
+
+
1677621948966
@@ -744,7 +716,7 @@
1687451515386
-
+
@@ -780,7 +752,6 @@
-
@@ -805,7 +776,8 @@
-
+
+
@@ -818,7 +790,7 @@
file://$PROJECT_DIR$/L5Sharp/L5X.cs
- 254
+ 232
@@ -829,19 +801,6 @@
-
- file://$PROJECT_DIR$/../tests/L5Sharp.Tests/ProofTesting.cs
- 31
-
-
-
-
-
-
-
-
-
-
diff --git a/src/L5Sharp/Common/CrossReference.cs b/src/L5Sharp/Common/CrossReference.cs
index f348e3d7..6adb260f 100644
--- a/src/L5Sharp/Common/CrossReference.cs
+++ b/src/L5Sharp/Common/CrossReference.cs
@@ -26,8 +26,10 @@ public class CrossReference
/// The name of the component that is being referenced.
/// The optional instruction name/key for the reference.
/// This is intended for code references as opposed to component references. Will be null if not applicable.
+ ///
/// element, type, or name is null.
- public CrossReference(XElement element, string type, string reference, Instruction? instruction = null)
+ public CrossReference(XElement element, string type, string reference, string? instruction = null,
+ string? operand = null)
{
_element = element ?? throw new ArgumentNullException(nameof(element));
@@ -39,6 +41,7 @@ public CrossReference(XElement element, string type, string reference, Instructi
Type = type;
Reference = reference;
Instruction = instruction;
+ Operand = operand;
}
///
@@ -82,9 +85,9 @@ public CrossReference(XElement element, string type, string reference, Instructi
/// the number of the referencing rung or line of logic (for RLL and ST code), or the ID of the referencing
/// diagram block (for FBD/SFC code). This helps further identify the reference element relative to other references.
///
- public string ElementId => _element.Attribute(L5XName.Name) is not null ? _element.Attribute(L5XName.Name)!.Value
+ public string ElementId => _element.Attribute(L5XName.ID) is not null ? _element.Attribute(L5XName.ID)!.Value
: _element.Attribute(L5XName.Number) is not null ? _element.Attribute(L5XName.Number)!.Value
- : _element.Attribute(L5XName.ID) is not null ? _element.Attribute(L5XName.ID)!.Value
+ : _element.Attribute(L5XName.Name) is not null ? _element.Attribute(L5XName.Name)!.Value
: string.Empty;
///
@@ -102,7 +105,7 @@ public CrossReference(XElement element, string type, string reference, Instructi
///
/// A indicating scope of the reference.
public Scope Scope => Scope.Type(_element);
-
+
///
/// The name of the scoped program, instruction, or controller that the reference is contained within.
///
@@ -111,7 +114,7 @@ public CrossReference(XElement element, string type, string reference, Instructi
/// is contained within.
///
public string Container => Scope.Container(_element);
-
+
///
/// The name of the Routine that the reference is contained within, it is a
/// type element.
@@ -129,7 +132,12 @@ public CrossReference(XElement element, string type, string reference, Instructi
/// instruction can help for searching or filtering references and finding other references sharing the common
/// instruction.
///
- public Instruction? Instruction { get; }
+ public string? Instruction { get; }
+
+ ///
+ ///
+ ///
+ public string? Operand { get; }
///
public override bool Equals(object? obj)
diff --git a/src/L5Sharp/Common/Instruction.cs b/src/L5Sharp/Common/Instruction.cs
index 6bb0ccc3..80d3ba8b 100644
--- a/src/L5Sharp/Common/Instruction.cs
+++ b/src/L5Sharp/Common/Instruction.cs
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using JetBrains.Annotations;
using L5Sharp.Utilities;
+// ReSharper disable StringLiteralTypo
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
// ReSharper disable CommentTypo
@@ -14,7 +16,7 @@
namespace L5Sharp.Common;
///
-/// A class containing the
+///
///
[PublicAPI]
public sealed class Instruction
@@ -31,13 +33,13 @@ public sealed class Instruction
/// the instruction.
///
private const string KeyPattern = @"[A-Za-z_]\w{1,39}(?=\()";*/
-
+
///
/// Captures all content within parentheses, including outer parentheses and nested parentheses, assuming they
/// are balanced (number of opening equals number of closing).
///
private const string SignaturePattern = @"\((?>\((?)|[^()]+|\)(?<-c>))*(?(c)(?!))\)";
-
+
///
/// The regex pattern for Logix tag names without starting and ending anchors.
/// This pattern also includes a negative lookahead for removing text prior to parenthesis (i.e. instruction keys)
@@ -56,39 +58,27 @@ public sealed class Instruction
/// Creates a new with the provided string key and regex signature pattern.
///
/// The key identifier of the instruction.
+ ///
///
- public Instruction(string key, params Argument[] arguments)
+ private Instruction(string key, string? signature = null, params Argument[] arguments)
{
if (string.IsNullOrEmpty(key))
throw new ArgumentException("Instruction key cannot be null or empty.", nameof(key));
+
Key = key;
+ Signature = signature ?? $"{key}({DefaultArgs(arguments.Length)})";
Arguments = arguments;
+ Operadns = ExtractOperands(Signature);
}
- ///
- /// The collection of values for the instruction instance.
- ///
- /// A of value objects. These could represent literal values, tag names, or expressions.
- ///
- public IEnumerable Arguments { get; }
-
- ///
- /// Indicates whether this Instruction is one that calls or references a Routine component by name.
- ///
- public bool CallsRoutine => this == JSR || this == JXR || this == SFR || this == SFP || this == FOR;
-
- ///
- /// Indicates whether this Instruction is one that calls or references a Task component by name.
- ///
- public bool CallsTask => this == EVENT;
+ private IEnumerable ExtractOperands(string signature)
+ {
+ var input = Regex.Match(Signature, SignaturePattern).Value[1..^1];
- ///
- /// Indicates whether the instruction is conditional or evaluates a certain condition to be true or false, from which
- /// it directs the control flow of a program.
- ///
- /// true if the instruction is conditional; Otherwise, false.
- /// An example of a condition instruction is an .
- public bool IsConditional => ConditionalKeys().Contains(Key);
+ return !string.IsNullOrEmpty(input)
+ ? Regex.Split(input, ArgumentSplitPattern)
+ : Enumerable.Empty().ToArray();
+ }
///
/// The unique identifier of the instruction type.
@@ -107,50 +97,74 @@ public Instruction(string key, params Argument[] arguments)
/// A containing the signature of the Instruction.
/// This simply joins the and ecloses them in parenthesis.
///
- public string Signature => $"({string.Join(',', Arguments.AsEnumerable())})";
+ public string Signature { get; }
+
+ ///
+ /// The collection of values for the instruction instance.
+ ///
+ /// A of value objects. These could represent literal values, tag names, or expressions.
+ ///
+ public IEnumerable Arguments { get; }
+
+ ///
+ /// The collection of operand names found in the signature of the instruction.
+ ///
+ ///
+ public IEnumerable Operadns { get; }
///
/// The representation of the instruction instance.
///
/// A instance that represents the instruction in Logix neutral text format.
- public NeutralText Text => new($"{Key}{Signature}");
-
- ///
- public override bool Equals(object? obj)
- {
- if (ReferenceEquals(this, obj)) return true;
+ public NeutralText Text => new($"{Key}({string.Join(',', Arguments.AsEnumerable())})");
- return obj switch
- {
- Instruction other => Key.IsEquivalent(other.Key),
- string key => Key.IsEquivalent(key),
- _ => false
- };
- }
+ ///
+ /// Indicates whether the instruction is conditional or evaluates a certain condition to be true or false, from which
+ /// it directs the control flow of a program.
+ ///
+ /// true if the instruction is conditional; Otherwise, false.
+ /// An example of a condition instruction is an .
+ public bool IsConditional => Key is nameof(CMP) or nameof(EQU) or nameof(GEQ) or nameof(GRT) or nameof(LEQ)
+ or nameof(LES) or nameof(LIM) or nameof(MEQ) or nameof(NEQ) or nameof(XIC) or nameof(XIO);
- ///
- public override int GetHashCode() => Key.GetHashCode();
-
///
- /// Determines the the provided has the same.
+ /// Indicates whether this Instruction is one that calls or references a Task component by name.
///
- ///
- ///
- public bool IsEquivalent(Instruction? other) => other is not null && Text.Equals(other.Text);
+ public bool IsTaskCall => Key is nameof(EVENT);
///
- /// Creates a of the same type with the updated argument values.
+ /// Indicates whether this Instruction is one that calls or references a Routine component by name.
///
- /// The collection of arguments make up the instruction signature.
- /// A new complete with the provided values.
- public Instruction Append(params Argument[] arguments) => new(Key, Arguments.Concat(arguments).ToArray());
+ public bool IsRoutineCall => Key is nameof(JSR) or nameof(JXR) or nameof(SFR) or nameof(SFP) or nameof(FOR);
///
- /// Creates a of the same type with the updated argument values.
+ /// Indicates whether the instruction argument cound matches the operand count.
///
- /// The collection of arguments make up the instruction signature.
- /// A new complete with the provided values.
- public Instruction Of(params Argument[] arguments) => new(Key, arguments);
+ public bool IsValid => Key is nameof(JSR) or nameof(SBR) or nameof(RET) || Operadns.Count() == Arguments.Count();
+
+ ///
+ /// Creates a new with the provided key and optional arguments.
+ ///
+ /// A containing the unique name of the instruction.
+ /// A set of to initialize the intruction with.
+ /// A instance with the provided key and arguments.
+ ///
+ /// This factory method is the means through which to create unknown or other instruction that are not captured
+ /// in this classes static factory methods. If this is a known instruction, use the corresponding instruction
+ /// factory method so it can initialize the known signature.
+ ///
+ public static Instruction New(string key, params Argument[] args) => new(key, arguments: args);
+
+ ///
+ /// Creates a new with the provided key, signature, and optional arguments.
+ ///
+ /// A containing the unique name of the instruction.
+ /// A containing the method signature or format. This should be in the
+ /// format 'key(arg1,arg2,...)'.
+ /// A set of to initialize the intruction with.
+ /// A instance with the provided key, signature, and arguments.
+ public static Instruction New(string key, string? signature = null, params Argument[] args) =>
+ new(key, signature, args);
///
/// Parses the provided string neutral text into a instance.
@@ -161,20 +175,19 @@ public override bool Equals(object? obj)
public static Instruction Parse(string text)
{
if (string.IsNullOrEmpty(text))
- throw new ArgumentException("Instruction text cannot be null or empty.", nameof(text));
+ throw new ArgumentException("Instruction text can not be null or empty.", nameof(text));
if (!Regex.IsMatch(text, Pattern))
- throw new FormatException("Instruction text must be in the format of 'KEY(ARGUMENTS)'.");
+ throw new FormatException("Instruction text must be in the format of 'key(arg1,arg2,...)'.");
var key = text[..text.IndexOf('(')];
var signature = Regex.Match(text, SignaturePattern).Value[1..^1];
var arguments = Regex.Split(signature, ArgumentSplitPattern).Select(Argument.Parse).ToArray();
-
- return new Instruction(key, arguments);
- }
- ///
- public override string ToString() => Key;
+ return _known.Value.TryGetValue(key, out var create)
+ ? create().Of(arguments)
+ : new Instruction(key, arguments: arguments);
+ }
///
/// Returns a collection of all known or defined instances.
@@ -185,26 +198,60 @@ public static Instruction Parse(string text)
public static IEnumerable Keys() => _known.Value.Keys.AsEnumerable();
///
- /// Returns a collection of all known or defined instances.
+ /// Retrieves teh argument for a specified operand name from the instruction.
///
- ///
- /// A containing all known instances with no arguments.
- ///
- public static IEnumerable Known() => _known.Value.Values.AsEnumerable();
+ /// A containing the operand name to search for.
+ /// A representing the value passed
+ public Argument? GetArgument(string operand)
+ {
+ var index = Operadns.ToList().IndexOf(operand);
+ return index >= 0 ? Arguments.ElementAt(index) : default;
+ }
+
+ ///
+ /// Retrieves teh argument for a specified operand name from the instruction.
+ ///
+ /// A zero based index number at which to retrieve an argument.
+ /// A representing the value passed
+ public Argument? GetArgument(int index)
+ {
+ return index >= 0 && index < Arguments.Count() ? Arguments.ElementAt(index) : default;
+ }
///
- /// Implicitly converts the instance to a value.
+ /// Creates a of the same type with the updated argument values.
///
- /// The instruction to convert.
- /// A representing the instrcution key.
- public static implicit operator string(Instruction instruction) => instruction.Key;
+ /// The collection of arguments make up the instruction signature.
+ /// A new complete with the provided values.
+ public Instruction Append(params Argument[] arguments) =>
+ new(Key, Signature, Arguments.Concat(arguments).ToArray());
+
///
- /// Explicitly converts the value to an instance.
+ /// Creates a of the same type with the updated argument values.
///
- /// The string key of the instrution.
- ///
- public static implicit operator Instruction(string key) => new(key);
+ /// The collection of arguments make up the instruction signature.
+ /// A new complete with the provided values.
+ public Instruction Of(params Argument[] arguments) => new(Key, Signature, arguments);
+
+ ///
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(this, obj)) return true;
+
+ return obj switch
+ {
+ Instruction other => Equals(Text, other.Text),
+ string text => Text.ToString().IsEquivalent(text),
+ _ => false
+ };
+ }
+
+ ///
+ public override int GetHashCode() => Text.GetHashCode();
+
+ ///
+ public override string ToString() => Text;
///
/// Determines the equality of two instances.
@@ -222,1031 +269,1466 @@ public static Instruction Parse(string text)
/// true if the values are not equal; Otherwise, false.
public static bool operator !=(Instruction? left, Instruction? right) => !Equals(left, right);
- #region Instructions
+ ///
+ /// Implicitly converts the instance to a value.
+ ///
+ /// The instruction to convert.
+ /// A representing the instrcution key.
+ public static implicit operator string(Instruction instruction) => instruction.Key;
+
+ ///
+ /// Explicitly converts the value to an instance.
+ ///
+ /// The string key of the instrution.
+ ///
+ public static implicit operator Instruction(string key) => new(key, $"{key}()");
+
+ #region Factories
///
/// Gets the ABL instruction definition instance.
///
- public static readonly Instruction ABL = new(nameof(ABL));
+ public static Instruction ABL(Argument channel, Argument serial_port_control, Argument character_count) =>
+ new(nameof(ABL), "ABL(channel,serial_port_control,character_count)", channel, serial_port_control,
+ character_count);
///
/// Gets the ABS instruction definition instance.
///
- public static readonly Instruction ABS = new(nameof(ABS));
+ public static Instruction ABS(Argument source, Argument destination) =>
+ new(nameof(ABS), "ABS(source,destination)", source, destination);
///
/// Gets the ACB instruction definition instance.
///
- public static readonly Instruction ACB = new(nameof(ACB));
+ public static Instruction ACB(Argument channel, Argument serial_port_control, Argument character_count) =>
+ new(nameof(ACB), "ACB(channel,serial_port_control,character_count)", channel, serial_port_control,
+ character_count);
///
/// Gets the ACL instruction definition instance.
///
- public static readonly Instruction ACL = new(nameof(ACL));
+ public static Instruction
+ ACL(Argument channel, Argument clear_serial_port_read, Argument clear_serial_port_write) => new(nameof(ACL),
+ "ACL(channel,clear_serial_port_read,clear_serial_port_write)", channel, clear_serial_port_read,
+ clear_serial_port_write);
///
/// Gets the ACS instruction definition instance.
///
- public static readonly Instruction ACS = new(nameof(ACS));
+ public static Instruction ACS(Argument source, Argument destination) =>
+ new(nameof(ACS), "ACS(source,destination)", source, destination);
///
/// Gets the ADD instruction definition instance.
///
- public static readonly Instruction ADD = new(nameof(ADD));
+ public static Instruction ADD(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(ADD), "ADD(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the AFI instruction definition instance.
///
- public static readonly Instruction AFI = new(nameof(AFI));
+ public static Instruction AFI() => new(nameof(AFI), "AFI()");
///
/// Gets the AHL instruction definition instance.
///
- public static readonly Instruction AHL = new(nameof(AHL));
+ public static Instruction AHL(Argument channel, Argument ANDMask, Argument ORMask, Argument serial_port_control,
+ Argument channel_status) => new(nameof(AHL),
+ "AHL(channel,ANDMask,ORMask,serial_port_control,channel_status)", channel, ANDMask, ORMask,
+ serial_port_control, channel_status);
///
/// Gets the ALMA instruction definition instance.
///
- public static readonly Instruction ALMA = new(nameof(ALMA));
+ public static Instruction ALMA(Argument alma_tag, Argument @in, Argument program_acknowledge_all,
+ Argument program_disable, Argument program_enable) => new(nameof(ALMA),
+ "ALMA(alma_tag,in,program_acknowledge_all,program_disable,program_enable)", alma_tag, @in,
+ program_acknowledge_all, program_disable, program_enable);
///
/// Gets the ALMD instruction definition instance.
///
- public static readonly Instruction ALMD = new(nameof(ALMD));
+ public static Instruction ALMD(Argument almd_tag, Argument program_acknowledge, Argument program_reset,
+ Argument program_disable, Argument program_enable) => new(nameof(ALMD),
+ "ALMD(almd_tag,program_acknowledge,program_reset,program_disable,program_enable)", almd_tag,
+ program_acknowledge, program_reset, program_disable, program_enable);
///
/// Gets the AND instruction definition instance.
///
- public static readonly Instruction AND = new(nameof(AND));
+ public static Instruction AND(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(AND), "AND(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the ARD instruction definition instance.
///
- public static readonly Instruction ARD = new(nameof(ARD));
+ public static Instruction ARD(Argument channel, Argument destination, Argument serial_port_control,
+ Argument string_length, Argument characters_read) => new(nameof(ARD),
+ "ARD(channel,destination,serial_port_control,string_length,characters_read)", channel, destination,
+ serial_port_control, string_length, characters_read);
///
/// Gets the ARL instruction definition instance.
///
- public static readonly Instruction ARL = new(nameof(ARL));
+ public static Instruction ARL(Argument channel, Argument destination, Argument serial_port_control,
+ Argument string_length, Argument characters_read) => new(nameof(ARL),
+ "ARL(channel,destination,serial_port_control,string_length,characters_read)", channel, destination,
+ serial_port_control, string_length, characters_read);
///
/// Gets the ASN instruction definition instance.
///
- public static readonly Instruction ASN = new(nameof(ASN));
+ public static Instruction ASN(Argument source, Argument destination) =>
+ new(nameof(ASN), "ASN(source,destination)", source, destination);
///
/// Gets the ATN instruction definition instance.
///
- public static readonly Instruction ATN = new(nameof(ATN));
+ public static Instruction ATN(Argument source, Argument destination) =>
+ new(nameof(ATN), "ATN(source,destination)", source, destination);
///
/// Gets the AVC instruction definition instance.
///
- public static readonly Instruction AVC = new(nameof(AVC));
+ public static Instruction AVC(Argument avc_tag, Argument feedback_type, Argument feedback_reation_time,
+ Argument delay_type, Argument delay_time, Argument output_follows_actuate, Argument actuate,
+ Argument delay_enable, Argument feedback_1, Argument input_status, Argument output_status, Argument reset) =>
+ new(nameof(AVC),
+ "AVC(avc_tag,feedback_type,feedback_reation_time,delay_type,delay_time,output_follows_actuate,actuate,delay_enable,feedback_1,input_status,output_status,reset)",
+ avc_tag, feedback_type, feedback_reation_time, delay_type, delay_time, output_follows_actuate, actuate,
+ delay_enable, feedback_1, input_status, output_status, reset);
///
/// Gets the AVE instruction definition instance.
///
- public static readonly Instruction AVE = new(nameof(AVE));
+ public static Instruction AVE(Argument array, Argument dim_to_vary, Argument destination, Argument control,
+ Argument length, Argument position) => new(nameof(AVE),
+ "AVE(array,dim_to_vary,destination,control,length,position)", array, dim_to_vary, destination, control, length,
+ position);
///
/// Gets the AWA instruction definition instance.
///
- public static readonly Instruction AWA = new(nameof(AWA));
+ public static Instruction AWA(Argument channel, Argument source, Argument serial_port_control,
+ Argument string_length, Argument characters_sent) => new(nameof(AWA),
+ "AWA(channel,source,serial_port_control,string_length,characters_sent)", channel, source, serial_port_control,
+ string_length, characters_sent);
///
/// Gets the AWT instruction definition instance.
///
- public static readonly Instruction AWT = new(nameof(AWT));
+ public static Instruction AWT(Argument channel, Argument source, Argument serial_port_control,
+ Argument string_length, Argument characters_sent) => new(nameof(AWT),
+ "AWT(channel,source,serial_port_control,string_length,characters_sent)", channel, source, serial_port_control,
+ string_length, characters_sent);
///
/// Gets the BRK instruction definition instance.
///
- public static readonly Instruction BRK = new(nameof(BRK));
+ public static Instruction BRK() => new(nameof(BRK), "BRK()");
///
/// Gets the BSL instruction definition instance.
///
- public static readonly Instruction BSL = new(nameof(BSL));
+ public static Instruction BSL(Argument array, Argument control, Argument source_bit, Argument length) =>
+ new(nameof(BSL), "BSL(array,control,source_bit,length)", array, control, source_bit, length);
///
/// Gets the BSR instruction definition instance.
///
- public static readonly Instruction BSR = new(nameof(BSR));
+ public static Instruction BSR(Argument array, Argument control, Argument source_bit, Argument length) =>
+ new(nameof(BSR), "BSR(array,control,source_bit,length)", array, control, source_bit, length);
///
/// Gets the BTD instruction definition instance.
///
- public static readonly Instruction BTD = new(nameof(BTD));
+ public static Instruction BTD(Argument source, Argument source_bit, Argument destination, Argument destination_bit,
+ Argument length) => new(nameof(BTD),
+ "BTD(source,source_bit,destination,destination_bit,length)", source, source_bit, destination, destination_bit,
+ length);
///
/// Gets the CBCM instruction definition instance.
///
- public static readonly Instruction CBCM = new(nameof(CBCM));
+ public static Instruction CBCM(Argument cbcm_tag, Argument ack_type, Argument mode, Argument takeover_mode,
+ Argument enable, Argument safety_enable, Argument standard_enable, Argument arm_continuous, Argument start,
+ Argument stop_at_top, Argument press_in_motion, Argument motion_monitor_fault, Argument slide_zone,
+ Argument safety_enable_ack) => new(nameof(CBCM),
+ "CBCM(cbcm_tag,ack_type,mode,takeover_mode,enable,safety_enable,standard_enable,arm_continuous,start,stop_at_top,press_in_motion,motion_monitor_fault,slide_zone,safety_enable_ack)",
+ cbcm_tag, ack_type, mode, takeover_mode, enable, safety_enable, standard_enable, arm_continuous, start,
+ stop_at_top, press_in_motion, motion_monitor_fault, slide_zone, safety_enable_ack);
///
/// Gets the CBIM instruction definition instance.
///
- public static readonly Instruction CBIM = new(nameof(CBIM));
+ public static Instruction CBIM(Argument cbim_tag, Argument ack_type, Argument inch_time, Argument enable,
+ Argument safety_enable, Argument standard_enable, Argument start, Argument press_in_motion,
+ Argument motion_monitor_fault, Argument slide_zone, Argument safety_enable_ack) => new(nameof(CBIM),
+ "CBIM(cbim_tag,ack_type,inch_time,enable,safety_enable,standard_enable,start,press_in_motion,motion_monitor_fault,slide_zone,safety_enable_ack)",
+ cbim_tag, ack_type, inch_time, enable, safety_enable, standard_enable, start, press_in_motion,
+ motion_monitor_fault, slide_zone, safety_enable_ack);
///
/// Gets the CBSSM instruction definition instance.
///
- public static readonly Instruction CBSSM = new(nameof(CBSSM));
+ public static Instruction CBSSM(Argument cbssm_tag, Argument ack_type, Argument takeover_mode, Argument enable,
+ Argument safety_enable, Argument standard_enable, Argument start, Argument press_in_motion,
+ Argument motion_monitor_fault, Argument slide_zone, Argument saefty_enable_ack) => new(nameof(CBSSM),
+ "CBSSM(cbssm_tag,ack_type,takeover_mode,enable,safety_enable,standard_enable,start,press_in_motion,motion_monitor_fault,slide_zone,saefty_enable_ack)",
+ cbssm_tag, ack_type, takeover_mode, enable, safety_enable, standard_enable, start, press_in_motion,
+ motion_monitor_fault, slide_zone, saefty_enable_ack);
///
/// Gets the CLR instruction definition instance.
///
- public static readonly Instruction CLR = new(nameof(CLR));
+ public static Instruction CLR(Argument destination) => new(nameof(CLR), "CLR(destination)", destination);
///
/// Gets the CMP instruction definition instance.
///
- public static readonly Instruction CMP = new(nameof(CMP), false);
+ public static Instruction CMP(Argument expression) => new(nameof(CMP), "CMP(expression)", expression);
///
/// Gets the CONCAT instruction definition instance.
///
- public static readonly Instruction CONCAT = new(nameof(CONCAT));
+ public static Instruction CONCAT(Argument sourceA, Argument sourceB, Argument destination) =>
+ new(nameof(CONCAT), "CONCAT(sourceA,sourceB,destination)", sourceA, sourceB, destination);
///
/// Gets the COP instruction definition instance.
///
- public static readonly Instruction COP = new(nameof(COP));
+ public static Instruction COP(Argument source, Argument destination, Argument length) => new(nameof(COP),
+ "COP(source,destination,length)", source, destination, length);
///
/// Gets the COS instruction definition instance.
///
- public static readonly Instruction COS = new(nameof(COS));
+ public static Instruction COS(Argument source, Argument destination) =>
+ new(nameof(COS), "COS(source,destination)", source, destination);
///
/// Gets the CPM instruction definition instance.
///
- public static readonly Instruction CPM = new(nameof(CPM));
+ public static Instruction CPM(Argument cpm_tag, Argument cam_profile, Argument enable, Argument brake_cam,
+ Argument takeover_cam, Argument dynamic_cam, Argument input_status, Argument reverse,
+ Argument press_motion_status, Argument reset) => new(nameof(CPM),
+ "CPM(cpm_tag,cam_profile,enable,brake_cam,takeover_cam,dynamic_cam,input_status,reverse,press_motion_status,reset)",
+ cpm_tag, cam_profile, enable, brake_cam, takeover_cam, dynamic_cam, input_status, reverse, press_motion_status,
+ reset);
///
/// Gets the CPS instruction definition instance.
///
- public static readonly Instruction CPS = new(nameof(CPS));
+ public static Instruction CPS(Argument source, Argument destination, Argument length) => new(nameof(CPS),
+ "CPS(source,destination,length)", source, destination, length);
///
/// Gets the CPT instruction definition instance.
///
- public static readonly Instruction CPT = new(nameof(CPT));
+ public static Instruction CPT(Argument destination, Argument expression) =>
+ new(nameof(CPT), "CPT(destination,expression)", destination, expression);
///
/// Gets the CROUT instruction definition instance.
///
- public static readonly Instruction CROUT = new(nameof(CROUT));
+ public static Instruction CROUT(Argument crout_tag, Argument feedback_type, Argument feedback_reaction_time,
+ Argument actuate, Argument feedback_1, Argument feedback_2, Argument input_status, Argument output_status,
+ Argument reset) => new(nameof(CROUT),
+ "CROUT(crout_tag,feedback_type,feedback_reaction_time,actuate,feedback_1,feedback_2,input_status,output_status,reset)",
+ crout_tag, feedback_type, feedback_reaction_time, actuate, feedback_1, feedback_2, input_status, output_status,
+ reset);
///
/// Gets the CSM instruction definition instance.
///
- public static readonly Instruction CSM = new(nameof(CSM));
+ public static Instruction CSM(Argument csm_tag, Argument mechanical_delay_timer, Argument max_pulse_period,
+ Argument motion_request, Argument channel_A, Argument channel_B, Argument input_status, Argument reset) => new(
+ nameof(CSM),
+ "CSM(csm_tag,mechanical_delay_timer,max_pulse_period,motion_request,channel_A,channel_B,input_status,reset)",
+ csm_tag, mechanical_delay_timer, max_pulse_period, motion_request, channel_A, channel_B, input_status, reset);
///
/// Gets the CTD instruction definition instance.
///
- public static readonly Instruction CTD = new(nameof(CTD));
+ public static Instruction CTD(Argument counter, Argument preset, Argument accum) =>
+ new(nameof(CTD), "CTD(counter,preset,accum)", counter, preset, accum);
///
/// Gets the CTU instruction definition instance.
///
- public static readonly Instruction CTU = new(nameof(CTU));
+ public static Instruction CTU(Argument counter, Argument preset, Argument accum) =>
+ new(nameof(CTU), "CTU(counter,preset,accum)", counter, preset, accum);
///
/// Gets the DCM instruction definition instance.
///
- public static readonly Instruction DCM = new(nameof(DCM));
+ public static Instruction DCM(Argument dcm_tag, Argument safety_function, Argument input_type,
+ Argument descrepancy_time, Argument channel_A, Argument channel_B, Argument input_status, Argument reset) =>
+ new(nameof(DCM),
+ "DCM(dcm_tag,safety_function,input_type,descrepancy_time,channel_A,channel_B,input_status,reset)", dcm_tag,
+ safety_function, input_type, descrepancy_time, channel_A, channel_B, input_status, reset);
///
/// Gets the DCS instruction definition instance.
///
- public static readonly Instruction DCS = new(nameof(DCS));
+ public static Instruction DCS(Argument dcs_tag, Argument safety_function, Argument input_type,
+ Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument channel_A,
+ Argument channel_B, Argument input_status, Argument reset) => new(nameof(DCS),
+ "DCS(dcs_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,channel_A,channel_B,input_status,reset)",
+ dcs_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, channel_A, channel_B,
+ input_status, reset);
///
/// Gets the DCSRT instruction definition instance.
///
- public static readonly Instruction DCSRT = new(nameof(DCSRT));
+ public static Instruction DCSRT(Argument dcsrt_tag, Argument safety_function, Argument input_type,
+ Argument discrepancy_time, Argument enable, Argument channel_A, Argument channel_B, Argument input_status,
+ Argument reset) => new(nameof(DCSRT),
+ "DCSRT(dcsrt_tag,safety_function,input_type,discrepancy_time,enable,channel_A,channel_B,input_status,reset)",
+ dcsrt_tag, safety_function, input_type, discrepancy_time, enable, channel_A, channel_B, input_status, reset);
///
/// Gets the DCST instruction definition instance.
///
- public static readonly Instruction DCST = new(nameof(DCST));
+ public static Instruction DCST(Argument dcst_tag, Argument safety_function, Argument input_type,
+ Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument channel_A,
+ Argument channel_B, Argument test_request, Argument input_status, Argument reset) => new(nameof(DCST),
+ "DCST(dcst_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,channel_A,channel_B,test_request,input_status,reset)",
+ dcst_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, channel_A, channel_B,
+ test_request, input_status, reset);
///
/// Gets the DCSTM instruction definition instance.
///
- public static readonly Instruction DCSTM = new(nameof(DCSTM));
+ public static Instruction DCSTM(Argument dcstm_tag, Argument safety_function, Argument input_type,
+ Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument test_type,
+ Argument test_time, Argument channel_A, Argument channel_B, Argument test_request, Argument mute,
+ Argument muting_lamp_status, Argument input_status, Argument reset) => new(nameof(DCSTM),
+ "DCSTM(dcstm_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,test_type,test_time,channel_A,channel_B,test_request,mute,muting_lamp_status,input_status,reset)",
+ dcstm_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, test_type, test_time,
+ channel_A, channel_B, test_request, mute, muting_lamp_status, input_status, reset);
///
/// Gets the DCSTL instruction definition instance.
///
- public static readonly Instruction DCSTL = new(nameof(DCSTL));
+ public static Instruction DCSTL(Argument dcstl_tag, Argument safety_function, Argument input_type,
+ Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument channel_A,
+ Argument channel_B, Argument test_request, Argument unlock_request, Argument lock_feedback,
+ Argument hazard_stopped, Argument input_status, Argument reset) => new(nameof(DCSTL),
+ "DCSTL(dcstl_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,channel_A,channel_B,test_request,unlock_request,lock_feedback,hazard_stopped,input_status,reset)",
+ dcstl_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, channel_A, channel_B,
+ test_request, unlock_request, lock_feedback, hazard_stopped, input_status, reset);
///
/// Gets the DDT instruction definition instance.
///
- public static readonly Instruction DDT = new(nameof(DDT));
+ public static Instruction DDT(Argument source, Argument reference, Argument result, Argument cmp_control,
+ Argument length, Argument position, Argument result_control, Argument result_length,
+ Argument result_position) => new(nameof(DDT),
+ "DDT(source,reference,result,cmp_control,length,position,result_control,length,position)", source, reference,
+ result, cmp_control, length, position, result_control, result_length, result_position);
///
/// Gets the DEG instruction definition instance.
///
- public static readonly Instruction DEG = new(nameof(DEG));
+ public static Instruction DEG(Argument source, Argument destination) =>
+ new(nameof(DEG), "DEG(source,destination)", source, destination);
///
/// Gets the DELETE instruction definition instance.
///
- public static readonly Instruction DELETE = new(nameof(DELETE));
+ public static Instruction DELETE(Argument source, Argument quantity, Argument start, Argument destination) =>
+ new(nameof(DELETE), "DELETE(source,quantity,start,destination)", source, quantity, start, destination);
///
/// Gets the DIN instruction definition instance.
///
- public static readonly Instruction DIN = new(nameof(DIN));
+ public static Instruction DIN(Argument din_tag, Argument reset_type, Argument channel_A, Argument channel_B,
+ Argument circuit_reset, Argument fault_reset) => new(nameof(DIN),
+ "DIN(din_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", din_tag, reset_type, channel_A,
+ channel_B, circuit_reset, fault_reset);
///
/// Gets the DIV instruction definition instance.
///
- public static readonly Instruction DIV = new(nameof(DIV));
+ public static Instruction DIV(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(DIV), "DIV(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the DTOS instruction definition instance.
///
- public static readonly Instruction DTOS = new(nameof(DTOS));
+ public static Instruction DTOS(Argument source, Argument destination) =>
+ new(nameof(DTOS), "DTOS(source,destination)", source, destination);
///
/// Gets the DTR instruction definition instance.
///
- public static readonly Instruction DTR = new(nameof(DTR));
+ public static Instruction DTR(Argument source, Argument mask, Argument reference) =>
+ new(nameof(DTR), "DTR(source,mask,reference)", source, mask, reference);
///
/// Gets the ENPEN instruction definition instance.
///
- public static readonly Instruction ENPEN = new(nameof(ENPEN));
+ public static Instruction ENPEN(Argument enpen_tag, Argument reset_type, Argument channel_A, Argument channel_B,
+ Argument circuit_reset, Argument fault_reset) => new(nameof(ENPEN),
+ "ENPEN(enpen_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", enpen_tag, reset_type, channel_A,
+ channel_B, circuit_reset, fault_reset);
///
/// Gets the EOT instruction definition instance.
///
- public static readonly Instruction EOT = new(nameof(EOT));
+ public static Instruction EOT(Argument data_bit) => new(nameof(EOT), "EOT(data_bit)", data_bit);
///
/// Gets the EPMS instruction definition instance.
///
- public static readonly Instruction EPMS = new(nameof(EPMS));
+ public static Instruction EPMS(Argument epms_tag, Argument input_1, Argument input_2, Argument input_3,
+ Argument input_4, Argument input_5, Argument input_6, Argument input_7, Argument input_8, Argument input_status,
+ Argument lck, Argument reset) => new(nameof(EPMS),
+ "EPMS(epms_tag,input_1,input_2,input_3,input_4,input_5,input_6,input_7,input_8,input_status,lock,reset)",
+ epms_tag, input_1, input_2, input_3, input_4, input_5, input_6, input_7, input_8, input_status, lck, reset);
///
/// Gets the EQU instruction definition instance.
///
- public static readonly Instruction EQU = new(nameof(EQU), false);
+ public static Instruction EQU(Argument source_A, Argument source_B) =>
+ new(nameof(EQU), "EQU(source_A,source_B)", source_A, source_B);
///
/// Gets the ESTOP instruction definition instance.
///
- public static readonly Instruction ESTOP = new(nameof(ESTOP));
+ public static Instruction ESTOP(Argument estop_tag, Argument reset_type, Argument channel_A, Argument channel_B,
+ Argument circuit_reset, Argument fault_reset) => new(nameof(ESTOP),
+ "ESTOP(estop_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", estop_tag, reset_type, channel_A,
+ channel_B, circuit_reset, fault_reset);
///
/// Gets the EVENT instruction definition instance.
///
- public static readonly Instruction EVENT = new(nameof(EVENT));
+ public static Instruction EVENT(Argument task) => new(nameof(EVENT), "EVENT(task)", task);
///
/// Gets the FAL instruction definition instance.
///
- public static readonly Instruction FAL = new(nameof(FAL));
+ public static Instruction FAL(Argument control, Argument length, Argument position, Argument mode,
+ Argument destination, Argument expression) =>
+ new(nameof(FAL), "FAL(control,length,position,mode,destination,expression)", control, length, position, mode,
+ destination, expression);
///
/// Gets the FBC instruction definition instance.
///
- public static readonly Instruction FBC = new(nameof(FBC));
+ public static Instruction FBC(Argument source, Argument reference, Argument result, Argument cmp_control,
+ Argument length, Argument position, Argument result_control, Argument result_length,
+ Argument result_position) => new(nameof(FBC),
+ "FBC(source,reference,result,cmp_control,length,position,result_control,length,position)", source, reference,
+ result, cmp_control, length, position, result_control, result_length, result_position);
///
/// Gets the FFL instruction definition instance.
///
- public static readonly Instruction FFL = new(nameof(FFL));
+ public static Instruction FFL(Argument source, Argument FIFO, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(FFL), "FFL(source,FIFO,control,length,position)", source, FIFO, control, length, position);
///
/// Gets the FFU instruction definition instance.
///
- public static readonly Instruction FFU = new(nameof(FFU));
+ public static Instruction FFU(Argument FIFO, Argument destination, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(FFU), "FFU(FIFO,destination,control,length,position)", FIFO, destination, control, length,
+ position);
///
/// Gets the FIND instruction definition instance.
///
- public static readonly Instruction FIND = new(nameof(FIND));
+ public static Instruction FIND(Argument source, Argument search, Argument start, Argument result) =>
+ new(nameof(FIND), "FIND(source,search,start,result)", source, search, start, result);
///
/// Gets the FLL instruction definition instance.
///
- public static readonly Instruction FLL = new(nameof(FLL));
+ public static Instruction FLL(Argument source, Argument destination, Argument length) => new(nameof(FLL),
+ "FLL(source,destination,length)", source, destination, length);
///
/// Gets the FOR instruction definition instance.
///
- public static readonly Instruction FOR = new(nameof(FOR));
+ public static Instruction FOR(Argument routine_name, Argument index, Argument initial_value,
+ Argument terminal_value, Argument step_size) => new(nameof(FOR),
+ "FOR(routine_name,index,initial_value,terminal_value,step_size)", routine_name, index, initial_value,
+ terminal_value, step_size);
///
/// Gets the FPMS instruction definition instance.
///
- public static readonly Instruction FPMS = new(nameof(FPMS));
+ public static Instruction FPMS(Argument fpms_tag, Argument input_1, Argument input_2, Argument input_3,
+ Argument input_4, Argument input_5, Argument fault_reset) => new(nameof(FPMS),
+ "FPMS(fpms_tag,input_1,input_2,input_3,input_4,input_5,fault_reset)", fpms_tag, input_1, input_2, input_3,
+ input_4, input_5, fault_reset);
///
/// Gets the FRD instruction definition instance.
///
- public static readonly Instruction FRD = new(nameof(FRD));
+ public static Instruction FRD(Argument source, Argument destination) =>
+ new(nameof(FRD), "FRD(source,destination)", source, destination);
///
/// Gets the FSBM instruction definition instance.
///
- public static readonly Instruction FSBM = new(nameof(FSBM));
+ public static Instruction FSBM(Argument fsbm_tag, Argument restart_type, Argument S1_S2_time, Argument S2_LC_time,
+ Argument LC_S3_time, Argument S3_S4_time, Argument maximum_mute_time, Argument maximum_override_time,
+ Argument direction, Argument light_curtain, Argument sensor_1, Argument sensor_2, Argument sensor_3,
+ Argument sensor_4, Argument enable_mute, Argument @override, Argument input_status, Argument muting_lamp_status,
+ Argument reset) => new(nameof(FSBM),
+ "FSBM(fsbm_tag,restart_type,S1_S2_time,S2_LC_time,LC_S3_time,S3_S4_time,maximum_mute_time,maximum_override_time,direction,light_curtain,sensor_1,sensor_2,sensor_3,sensor_4,enable_mute,override,input_status,muting_lamp_status,reset)",
+ fsbm_tag, restart_type, S1_S2_time, S2_LC_time, LC_S3_time, S3_S4_time, maximum_mute_time,
+ maximum_override_time, direction, light_curtain, sensor_1, sensor_2, sensor_3, sensor_4, enable_mute, @override,
+ input_status, muting_lamp_status, reset);
///
/// Gets the FSC instruction definition instance.
///
- public static readonly Instruction FSC = new(nameof(FSC));
+ public static Instruction FSC(Argument control, Argument length, Argument position, Argument mode,
+ Argument expression) =>
+ new(nameof(FSC), "FSC(control,length,position,mode,expression)", control, length, position, mode, expression);
///
/// Gets the GEQ instruction definition instance.
///
- public static readonly Instruction GEQ = new(nameof(GEQ));
+ public static Instruction GEQ(Argument source_A, Argument source_B) =>
+ new(nameof(GEQ), "GEQ(source_A,source_B)", source_A, source_B);
///
/// Gets the GRT instruction definition instance.
///
- public static readonly Instruction GRT = new(nameof(GRT));
+ public static Instruction GRT(Argument source_A, Argument source_B) =>
+ new(nameof(GRT), "GRT(source_A,source_B)", source_A, source_B);
///
/// Gets the GSV instruction definition instance.
///
- public static readonly Instruction GSV = new(nameof(GSV));
+ public static Instruction GSV(Argument class_name, Argument instance_name, Argument attribute_name,
+ Argument destination) =>
+ new(nameof(GSV), "GSV(class_name,instance_name,attribute_name,destination)", class_name, instance_name,
+ attribute_name, destination);
///
/// Gets the INSERT instruction definition instance.
///
- public static readonly Instruction INSERT = new(nameof(INSERT));
+ public static Instruction INSERT(Argument sourceA, Argument sourceB, Argument start, Argument destination) =>
+ new(nameof(INSERT), "INSERT(sourceA,sourceB,start,destination)", sourceA, sourceB, start, destination);
///
/// Gets the IOT instruction definition instance.
///
- public static readonly Instruction IOT = new(nameof(IOT));
+ public static Instruction IOT(Argument output_tag) => new(nameof(IOT), "IOT(output_tag)", output_tag);
///
/// Gets the JMP instruction definition instance.
///
- public static readonly Instruction JMP = new(nameof(JMP));
+ public static Instruction JMP(Argument label_name) => new(nameof(JMP), "JMP(label_name)", label_name);
///
/// Gets the JSR instruction definition instance.
///
- public static readonly Instruction JSR = new(nameof(JSR));
+ public static Instruction JSR(Argument routine_name, Argument number_of_inputs, params Argument[]? parameters) =>
+ new(nameof(JSR), "JSR(routine_name,number_of_inputs,input_1,input_n,return_1,return_n)",
+ parameters is not null
+ ? new[] { routine_name, number_of_inputs }.Concat(parameters).ToArray()
+ : new[] { routine_name, number_of_inputs });
///
/// Gets the JXR instruction definition instance.
///
- public static readonly Instruction JXR = new(nameof(JXR));
+ public static Instruction JXR(Argument external_routine_name, Argument external_routine_control, Argument parameter,
+ Argument return_parameter) => new(nameof(JXR),
+ "JXR(external_routine_name,external_routine_control,parameter,return_parameter)", external_routine_name,
+ external_routine_control, parameter, return_parameter);
///
/// Gets the LBL instruction definition instance.
///
- public static readonly Instruction LBL = new(nameof(LBL));
+ public static Instruction LBL(Argument label_name) => new(nameof(LBL), "LBL(label_name)", label_name);
///
/// Gets the LC instruction definition instance.
///
- public static readonly Instruction LC = new(nameof(LC));
+ public static Instruction LC(Argument lc_tag, Argument reset_type, Argument channel_A, Argument channel_B,
+ Argument input_filter_time, Argument mute_light_curtain, Argument circuit_reset, Argument fault_reset) => new(
+ nameof(LC),
+ "LC(lc_tag,reset_type,channel_A,channel_B,input_filter_time,mute_light_curtain,circuit_reset,fault_reset)",
+ lc_tag, reset_type, channel_A, channel_B, input_filter_time, mute_light_curtain, circuit_reset, fault_reset);
///
/// Gets the LEQ instruction definition instance.
///
- public static readonly Instruction LEQ = new(nameof(LEQ));
+ public static Instruction LEQ(Argument source_A, Argument source_B) =>
+ new(nameof(LEQ), "LEQ(source_A,source_B)", source_A, source_B);
///
/// Gets the LES instruction definition instance.
///
- public static readonly Instruction LES = new(nameof(LES));
+ public static Instruction LES(Argument source_A, Argument source_B) =>
+ new(nameof(LES), "LES(source_A,source_B)", source_A, source_B);
///
/// Gets the LFL instruction definition instance.
///
- public static readonly Instruction LFL = new(nameof(LFL));
+ public static Instruction LFL(Argument source, Argument LIFO, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(LFL), "LFL(source,LIFO,control,length,position)", source, LIFO, control, length, position);
///
/// Gets the LFU instruction definition instance.
///
- public static readonly Instruction LFU = new(nameof(LFU));
+ public static Instruction LFU(Argument LIFO, Argument destination, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(LFU), "LFU(LIFO,destination,control,length,position)", LIFO, destination, control, length,
+ position);
///
/// Gets the LIM instruction definition instance.
///
- public static readonly Instruction LIM = new(nameof(LIM));
+ public static Instruction LIM(Argument low_limit, Argument test, Argument high_limit) => new(nameof(LIM),
+ "LIM(low_limit,test,high_limit)", low_limit, test, high_limit);
///
/// Gets the LN instruction definition instance.
///
- public static readonly Instruction LN = new(nameof(LN));
+ public static Instruction LN(Argument source, Argument destination) =>
+ new(nameof(LN), "LN(source,destination)", source, destination);
///
/// Gets the LOG instruction definition instance.
///
- public static readonly Instruction LOG = new(nameof(LOG));
+ public static Instruction LOG(Argument source, Argument destination) =>
+ new(nameof(LOG), "LOG(source,destination)", source, destination);
///
/// Gets the LOWER instruction definition instance.
///
- public static readonly Instruction LOWER = new(nameof(LOWER));
+ public static Instruction LOWER(Argument source, Argument destination) =>
+ new(nameof(LOWER), "LOWER(source,destination)", source, destination);
///
/// Gets the MAAT instruction definition instance.
///
- public static readonly Instruction MAAT = new(nameof(MAAT));
+ public static Instruction MAAT(Argument axis, Argument motion_control) =>
+ new(nameof(MAAT), "MAAT(axis,motion_control)", axis, motion_control);
///
/// Gets the MAFR instruction definition instance.
///
- public static readonly Instruction MAFR = new(nameof(MAFR));
+ public static Instruction MAFR(Argument axis, Argument motion_control) =>
+ new(nameof(MAFR), "MAFR(axis,motion_control)", axis, motion_control);
///
/// Gets the MAG instruction definition instance.
///
- public static readonly Instruction MAG = new(nameof(MAG));
+ public static Instruction MAG(Argument slave_axis, Argument master_axis, Argument motion_control,
+ Argument direction, Argument ratio, Argument slave_counts, Argument master_counts, Argument master_reference,
+ Argument ratio_format, Argument clutch, Argument accel_rate, Argument accel_units) => new(nameof(MAG),
+ "MAG(slave_axis,master_axis,motion_control,direction,ratio,slave_counts,master_counts,master_reference,ratio_format,clutch,accel_rate,accel_units)",
+ slave_axis, master_axis, motion_control, direction, ratio, slave_counts, master_counts, master_reference,
+ ratio_format, clutch, accel_rate, accel_units);
///
/// Gets the MAH instruction definition instance.
///
- public static readonly Instruction MAH = new(nameof(MAH));
+ public static Instruction MAH(Argument axis, Argument motion_control) =>
+ new(nameof(MAH), "MAH(axis,motion_control)", axis, motion_control);
///
/// Gets the MAHD instruction definition instance.
///
- public static readonly Instruction MAHD = new(nameof(MAHD));
+ public static Instruction MAHD(Argument axis, Argument motion_control, Argument diagnostic_test,
+ Argument observed_direction) => new(nameof(MAHD),
+ "MAHD(axis,motion_control,diagnostic_test,observed_direction)", axis, motion_control, diagnostic_test,
+ observed_direction);
///
/// Gets the MAJ instruction definition instance.
///
- public static readonly Instruction MAJ = new(nameof(MAJ));
+ public static Instruction MAJ(Argument axis, Argument motion_control, Argument direction, Argument speed,
+ Argument speed_units, Argument accel_rate, Argument accel_units, Argument decel_rate, Argument decel_units,
+ Argument profile, Argument merge, Argument merge_speed) => new(nameof(MAJ),
+ "MAJ(axis,motion_control,direction,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile,merge,merge_speed)",
+ axis, motion_control, direction, speed, speed_units, accel_rate, accel_units, decel_rate, decel_units, profile,
+ merge, merge_speed);
///
/// Gets the MAM instruction definition instance.
///
- public static readonly Instruction MAM = new(nameof(MAM));
+ public static Instruction MAM(Argument axis, Argument motion_control, Argument move_type, Argument position,
+ Argument speed, Argument speed_units, Argument accel_rate, Argument accel_units, Argument decel_rate,
+ Argument decel_units, Argument profile, Argument merge, Argument merge_speed) => new(nameof(MAM),
+ "MAM(axis,motion_control,move_type,position,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile,merge,merge_speed)",
+ axis, motion_control, move_type, position, speed, speed_units, accel_rate, accel_units, decel_rate, decel_units,
+ profile, merge, merge_speed);
///
/// Gets the MAOC instruction definition instance.
///
- public static readonly Instruction MAOC = new(nameof(MAOC));
+ public static Instruction MAOC(Argument axis, Argument execution_target, Argument motion_control, Argument output,
+ Argument input, Argument output_cam, Argument cam_start_position, Argument cam_end_position,
+ Argument output_compensation, Argument execution_mode, Argument execution_schedule, Argument axis_arm_position,
+ Argument cam_arm_position, Argument reference) => new(nameof(MAOC),
+ "MAOC(axis,execution_target,motion_control,output,input,output_cam,cam_start_position,cam_end_position,output_compensation,execution_mode,execution_schedule,axis_arm_position,cam_arm_position,reference)",
+ axis, execution_target, motion_control, output, input, output_cam, cam_start_position, cam_end_position,
+ output_compensation, execution_mode, execution_schedule, axis_arm_position, cam_arm_position, reference);
///
/// Gets the MAPC instruction definition instance.
///
- public static readonly Instruction MAPC = new(nameof(MAPC));
+ public static Instruction MAPC(Argument slave_axis, Argument master_axis, Argument motion_control,
+ Argument direction, Argument cam_profile, Argument slave_scaling, Argument master_scaling,
+ Argument execution_mode, Argument execution_schedule, Argument master_lock_position, Argument cam_lock_position,
+ Argument master_reference, Argument master_direction) => new(nameof(MAPC),
+ "MAPC(slave_axis,master_axis,motion_control,direction,cam_profile,slave_scaling,master_scaling,execution_mode,execution_schedule,master_lock_position,cam_lock_position,master_reference,master_direction)",
+ slave_axis, master_axis, motion_control, direction, cam_profile, slave_scaling, master_scaling, execution_mode,
+ execution_schedule, master_lock_position, cam_lock_position, master_reference, master_direction);
///
/// Gets the MAR instruction definition instance.
///
- public static readonly Instruction MAR = new(nameof(MAR));
+ public static Instruction MAR(Argument axis, Argument motion_control, Argument trigger_condition,
+ Argument windowed_registration, Argument minimum_position, Argument maximum_position) => new(nameof(MAR),
+ "MAR(axis,motion_control,trigger_condition,windowed_registration,minimum_position,maximum_position)", axis,
+ motion_control, trigger_condition, windowed_registration, minimum_position, maximum_position);
///
/// Gets the MAS instruction definition instance.
///
- public static readonly Instruction MAS = new(nameof(MAS));
+ public static Instruction MAS(Argument axis, Argument motion_control, Argument stop_type, Argument change_decel,
+ Argument decel_rate, Argument decel_units) => new(nameof(MAS),
+ "MAS(axis,motion_control,stop_type,change_decel,decel_rate,decel_units)", axis, motion_control, stop_type,
+ change_decel, decel_rate, decel_units);
///
/// Gets the MASD instruction definition instance.
///
- public static readonly Instruction MASD = new(nameof(MASD));
+ public static Instruction MASD(Argument axis, Argument motion_control) =>
+ new(nameof(MASD), "MASD(axis,motion_control)", axis, motion_control);
///
/// Gets the MASR instruction definition instance.
///
- public static readonly Instruction MASR = new(nameof(MASR));
+ public static Instruction MASR(Argument axis, Argument motion_control) =>
+ new(nameof(MASR), "MASR(axis,motion_control)", axis, motion_control);
///
/// Gets the MATC instruction definition instance.
///
- public static readonly Instruction MATC = new(nameof(MATC));
+ public static Instruction MATC(Argument axis, Argument motion_control, Argument direction, Argument cam_profile,
+ Argument distance_scaling, Argument time_scaling, Argument execution_mode, Argument execution_schedule) => new(
+ nameof(MATC),
+ "MATC(axis,motion_control,direction,cam_profile,distance_scaling,time_scaling,execution_mode,execution_schedule)",
+ axis, motion_control, direction, cam_profile, distance_scaling, time_scaling, execution_mode,
+ execution_schedule);
///
/// Gets the MAW instruction definition instance.
///
- public static readonly Instruction MAW = new(nameof(MAW));
+ public static Instruction MAW(Argument axis, Argument motion_control, Argument trigger_condition,
+ Argument position) =>
+ new(nameof(MAW), "MAW(axis,motion_control,trigger_condition,position)", axis, motion_control,
+ trigger_condition, position);
///
/// Gets the MCCD instruction definition instance.
///
- public static readonly Instruction MCCD = new(nameof(MCCD));
+ public static Instruction MCCD(Argument coordinate_system, Argument motion_control, Argument motion_type,
+ Argument change_speed, Argument speed, Argument speed_units, Argument change_accel, Argument accel_rate,
+ Argument accel_units, Argument change_decel, Argument decel_rate, Argument decel_units, Argument scope) => new(
+ nameof(MCCD),
+ "MCCD(coordinate_system,motion_control,motion_type,change_speed,speed,speed_units,change_accel,accel_rate,accel_units,change_decel,decel_rate, decel_units,scope)",
+ coordinate_system, motion_control, motion_type, change_speed, speed, speed_units, change_accel, accel_rate,
+ accel_units, change_decel, decel_rate, decel_units, scope);
///
/// Gets the MCCM instruction definition instance.
///
- public static readonly Instruction MCCM = new(nameof(MCCM));
+ public static Instruction MCCM(Argument coordinate_system, Argument motion_control, Argument move_type,
+ Argument position, Argument circle_type, Argument radius, Argument direction, Argument speed,
+ Argument speed_units, Argument accel_rate, Argument accel_units, Argument decel_rate, Argument decel_units,
+ Argument profile, Argument termination_type, Argument merge, Argument merge_speed) => new(nameof(MCCM),
+ "MCCM(coordinate_system,motion_control,move_type,position,circle_type,via/center/radius,direction,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile,termination_type,merge,merge_speed)",
+ coordinate_system, motion_control, move_type, position, circle_type, radius, direction, speed, speed_units,
+ accel_rate, accel_units, decel_rate, decel_units, profile, termination_type, merge, merge_speed);
///
/// Gets the MCCP instruction definition instance.
///
- public static readonly Instruction MCCP = new(nameof(MCCP));
+ public static Instruction MCCP(Argument motion_control, Argument cam, Argument length, Argument start_slope,
+ Argument end_slope, Argument cam_profile) => new(nameof(MCCP),
+ "MCCP(motion_control,cam,length,start_slope,end_slope,cam_profile)", motion_control, cam, length, start_slope,
+ end_slope, cam_profile);
///
/// Gets the MCLM instruction definition instance.
///
- public static readonly Instruction MCLM = new(nameof(MCLM));
+ public static Instruction MCLM(Argument coordinate_system, Argument motion_control, Argument move_type,
+ Argument position, Argument speed, Argument speed_units, Argument accel_rate, Argument accel_units,
+ Argument decel_rate, Argument decel_units, Argument profile, Argument termination_type, Argument merge,
+ Argument merge_speed) => new(nameof(MCLM),
+ "MCLM(coordinate_system,motion_control,move_type,position,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile, termination_type,merge,merge_speed)",
+ coordinate_system, motion_control, move_type, position, speed, speed_units, accel_rate, accel_units, decel_rate,
+ decel_units, profile, termination_type, merge, merge_speed);
///
/// Gets the MCD instruction definition instance.
///
- public static readonly Instruction MCD = new(nameof(MCD));
+ public static Instruction MCD(Argument axis, Argument motion_control, Argument motion_type, Argument change_speed,
+ Argument speed, Argument change_accel, Argument accel_rate, Argument change_decel, Argument decel_rate,
+ Argument speed_units, Argument accel_units, Argument decel_units) => new(nameof(MCD),
+ "MCD(axis,motion_control,motion_type,change_speed,speed,change_accel,accel_rate,change_decel,decel_rate,speed_units,accel_units,decel_units)",
+ axis, motion_control, motion_type, change_speed, speed, change_accel, accel_rate, change_decel, decel_rate,
+ speed_units, accel_units, decel_units);
///
/// Gets the MCR instruction definition instance.
///
- public static readonly Instruction MCR = new(nameof(MCR));
+ public static Instruction MCR() => new(nameof(MCR), "MCR()");
///
/// Gets the MCS instruction definition instance.
///
- public static readonly Instruction MCS = new(nameof(MCS));
+ public static Instruction MCS(Argument coordinate_system, Argument motion_control, Argument stop_type,
+ Argument change_decel, Argument decel_rate, Argument decel_units) => new(nameof(MCS),
+ "MCS(coordinate_system,motion_control,stop_type,change_decel,decel_rate, decel_units)", coordinate_system,
+ motion_control, stop_type, change_decel, decel_rate, decel_units);
///
/// Gets the MCSD instruction definition instance.
///
- public static readonly Instruction MCSD = new(nameof(MCSD));
+ public static Instruction MCSD(Argument coordinate_system, Argument motion_control) =>
+ new(nameof(MCSD), "MCSD(coordinate_system,motion_control)", coordinate_system, motion_control);
///
/// Gets the MCSR instruction definition instance.
///
- public static readonly Instruction MCSR = new(nameof(MCSR));
+ public static Instruction MCSR(Argument coordinate_system, Argument motion_control) =>
+ new(nameof(MCSR), "MCSR(coordinate_system,motion_control)", coordinate_system, motion_control);
///
/// Gets the MCSV instruction definition instance.
///
- public static readonly Instruction MCSV = new(nameof(MCSV));
+ public static Instruction MCSV(Argument motion_control, Argument cam_profile, Argument master_value,
+ Argument slave_value, Argument slope_value, Argument slope_derivative) => new(nameof(MCSV),
+ "MCSV(motion_control,cam_profile,master_value,slave_value,slope_value,slope_derivative)", motion_control,
+ cam_profile, master_value, slave_value, slope_value, slope_derivative);
///
/// Gets the MCT instruction definition instance.
///
- public static readonly Instruction MCT = new(nameof(MCT));
+ public static Instruction MCT(Argument source_system, Argument target_system, Argument motion_control,
+ Argument orientation, Argument translation) => new(nameof(MCT),
+ "MCT(source_system,target_system,motion_control,orientation,translation)", source_system, target_system,
+ motion_control, orientation, translation);
///
/// Gets the MCTP instruction definition instance.
///
- public static readonly Instruction MCTP = new(nameof(MCTP));
+ public static Instruction MCTP(Argument source_system, Argument target_system, Argument motion_control,
+ Argument orientation, Argument translation, Argument transform_direction, Argument reference_position,
+ Argument transform_position) => new(nameof(MCTP),
+ "MCTP(source_system,target_system,motion_control,orientation,translation,transform_direction,reference_position,transform_position)",
+ source_system, target_system, motion_control, orientation, translation, transform_direction, reference_position,
+ transform_position);
///
/// Gets the MDF instruction definition instance.
///
- public static readonly Instruction MDF = new(nameof(MDF));
+ public static Instruction MDF(Argument axis, Argument motion_control) =>
+ new(nameof(MDF), "MDF(axis,motion_control)", axis, motion_control);
///
/// Gets the MDO instruction definition instance.
///
- public static readonly Instruction MDO = new(nameof(MDO));
+ public static Instruction MDO(Argument axis, Argument motion_control, Argument drive_output,
+ Argument drive_units) =>
+ new(nameof(MDO), "MDO(axis,motion_control,drive_output,drive_units)", axis, motion_control, drive_output,
+ drive_units);
///
/// Gets the MDOC instruction definition instance.
///
- public static readonly Instruction MDOC = new(nameof(MDOC));
+ public static Instruction MDOC(Argument axis, Argument execution_target, Argument motion_control,
+ Argument disarm_type) =>
+ new(nameof(MDOC), "MDOC(axis,execution_target,motion_control,disarm_type)", axis, execution_target,
+ motion_control, disarm_type);
///
/// Gets the MDR instruction definition instance.
///
- public static readonly Instruction MDR = new(nameof(MDR));
+ public static Instruction MDR(Argument axis, Argument motion_control) =>
+ new(nameof(MDR), "MDR(axis,motion_control)", axis, motion_control);
///
/// Gets the MDW instruction definition instance.
///
- public static readonly Instruction MDW = new(nameof(MDW));
+ public static Instruction MDW(Argument axis, Argument motion_control) =>
+ new(nameof(MDW), "MDW(axis,motion_control)", axis, motion_control);
///
/// Gets the MEQ instruction definition instance.
///
- public static readonly Instruction MEQ = new(nameof(MEQ));
+ public static Instruction MEQ(Argument source, Argument mask, Argument compare) =>
+ new(nameof(MEQ), "MEQ(source,mask,compare)", source, mask, compare);
///
/// Gets the MGS instruction definition instance.
///
- public static readonly Instruction MGS = new(nameof(MGS));
+ public static Instruction MGS(Argument group, Argument motion_control, Argument stop_mode) =>
+ new(nameof(MGS), "MGS(group,motion_control,stop_mode)", group, motion_control, stop_mode);
///
/// Gets the MGSD instruction definition instance.
///
- public static readonly Instruction MGSD = new(nameof(MGSD));
+ public static Instruction MGSD(Argument group, Argument motion_control) =>
+ new(nameof(MGSD), "MGSD(group,motion_control)", group, motion_control);
///
/// Gets the MGSP instruction definition instance.
///
- public static readonly Instruction MGSP = new(nameof(MGSP));
+ public static Instruction MGSP(Argument group, Argument motion_control) =>
+ new(nameof(MGSP), "MGSP(group,motion_control)", group, motion_control);
///
/// Gets the MGSR instruction definition instance.
///
- public static readonly Instruction MGSR = new(nameof(MGSR));
+ public static Instruction MGSR(Argument group, Argument motion_control) =>
+ new(nameof(MGSR), "MGSR(group,motion_control)", group, motion_control);
///
/// Gets the MID instruction definition instance.
///
- public static readonly Instruction MID = new(nameof(MID));
+ public static Instruction MID(Argument source, Argument quantity, Argument start, Argument destination) =>
+ new(nameof(MID), "MID(source,quantity,start,destination)", source, quantity, start, destination);
///
/// Gets the MMVC instruction definition instance.
///
- public static readonly Instruction MMVC = new(nameof(MMVC));
+ public static Instruction MMVC(Argument mmvc_tag, Argument enable, Argument keyswitch, Argument bottom,
+ Argument flywheel_stopped, Argument safety_enable, Argument actuate, Argument input_status,
+ Argument output_status, Argument reset) => new(nameof(MMVC),
+ "MMVC(mmvc_tag,enable,keyswitch,bottom,flywheel_stopped,safety_enable,actuate,input_status,output_status,reset)",
+ mmvc_tag, enable, keyswitch, bottom, flywheel_stopped, safety_enable, actuate, input_status, output_status,
+ reset);
///
/// Gets the MOD instruction definition instance.
///
- public static readonly Instruction MOD = new(nameof(MOD));
+ public static Instruction MOD(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(MOD), "MOD(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the MOV instruction definition instance.
///
- public static readonly Instruction MOV = new(nameof(MOV));
+ public static Instruction MOV(Argument source, Argument destination) =>
+ new(nameof(MOV), "MOV(source,destination)", source, destination);
///
/// Gets the MRAT instruction definition instance.
///
- public static readonly Instruction MRAT = new(nameof(MRAT));
+ public static Instruction MRAT(Argument axis, Argument motion_control) =>
+ new(nameof(MRAT), "MRAT(axis,motion_control)", axis, motion_control);
///
/// Gets the MRHD instruction definition instance.
///
- public static readonly Instruction MRHD = new(nameof(MRHD));
+ public static Instruction MRHD(Argument axis, Argument motion_control, Argument diagnostic_test) =>
+ new(nameof(MRHD), "MRHD(axis,motion_control,diagnostic_test)", axis, motion_control, diagnostic_test);
///
/// Gets the MRP instruction definition instance.
///
- public static readonly Instruction MRP = new(nameof(MRP));
+ public static Instruction MRP(Argument axis, Argument motion_control, Argument type, Argument position_select,
+ Argument position) =>
+ new(nameof(MRP), "MRP(axis,motion_control,type,position_select,position)", axis, motion_control, type,
+ position_select, position);
///
/// Gets the MSF instruction definition instance.
///
- public static readonly Instruction MSF = new(nameof(MSF));
+ public static Instruction MSF(Argument axis, Argument motion_control) =>
+ new(nameof(MSF), "MSF(axis,motion_control)", axis, motion_control);
///
/// Gets the MSG instruction definition instance.
///
- public static readonly Instruction MSG = new(nameof(MSG));
+ public static Instruction MSG(Argument message_control) =>
+ new(nameof(MSG), "MSG(message_control)", message_control);
///
/// Gets the MSO instruction definition instance.
///
- public static readonly Instruction MSO = new(nameof(MSO));
+ public static Instruction MSO(Argument axis, Argument motion_control) =>
+ new(nameof(MSO), "MSO(axis,motion_control)", axis, motion_control);
///
/// Gets the MUL instruction definition instance.
///
- public static readonly Instruction MUL = new(nameof(MUL));
+ public static Instruction MUL(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(MUL), "MUL(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the MVC instruction definition instance.
///
- public static readonly Instruction MVC = new(nameof(MVC));
+ public static Instruction MVC(Argument mvc_tag, Argument feedback_type, Argument feedback_reaction_time,
+ Argument actuate, Argument feedback_1, Argument feedback_2, Argument input_status, Argument output_status,
+ Argument reset) => new(nameof(MVC),
+ "MVC(mvc_tag,feedback_type,feedback_reaction_time,actuate,feedback_1,feedback_2,input_status,output_status,reset)",
+ mvc_tag, feedback_type, feedback_reaction_time, actuate, feedback_1, feedback_2, input_status, output_status,
+ reset);
///
/// Gets the MVM instruction definition instance.
///
- public static readonly Instruction MVM = new(nameof(MVM));
+ public static Instruction MVM(Argument source, Argument mask, Argument destination) =>
+ new(nameof(MVM), "MVM(source,mask,destination)", source, mask, destination);
///
/// Gets the NEG instruction definition instance.
///
- public static readonly Instruction NEG = new(nameof(NEG));
+ public static Instruction NEG(Argument source, Argument destination) =>
+ new(nameof(NEG), "NEG(source,destination)", source, destination);
///
/// Gets the NEQ instruction definition instance.
///
- public static readonly Instruction NEQ = new(nameof(NEQ));
+ public static Instruction NEQ(Argument source_A, Argument source_B) =>
+ new(nameof(NEQ), "NEQ(source_A,source_B)", source_A, source_B);
///
/// Gets the NOP instruction definition instance.
///
- public static readonly Instruction NOP = new(nameof(NOP));
+ public static Instruction NOP() => new(nameof(NOP), "NOP()");
///
/// Gets the NOT instruction definition instance.
///
- public static readonly Instruction NOT = new(nameof(NOT));
+ public static Instruction NOT(Argument source, Argument destination) =>
+ new(nameof(NOT), "NOT(source,destination)", source, destination);
///
/// Gets the ONS instruction definition instance.
///
- public static readonly Instruction ONS = new(nameof(ONS));
+ public static Instruction ONS(Argument storage_bit) => new(nameof(ONS), "ONS(storage_bit)", storage_bit);
///
/// Gets the OR instruction definition instance.
///
- public static readonly Instruction OR = new(nameof(OR));
+ public static Instruction OR(Argument source_A, Argument source_B, Argument destination) => new(nameof(OR),
+ "OR(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the OSF instruction definition instance.
///
- public static readonly Instruction OSF = new(nameof(OSF));
+ public static Instruction OSF(Argument storage_bit, Argument output_bit) =>
+ new(nameof(OSF), "OSF(storage_bit,output_bit)", storage_bit, output_bit);
///
/// Gets the OSR instruction definition instance.
///
- public static readonly Instruction OSR = new(nameof(OSR));
+ public static Instruction OSR(Argument storage_bit, Argument output_bit) =>
+ new(nameof(OSR), "OSR(storage_bit,output_bit)", storage_bit, output_bit);
///
/// Gets the OTE instruction definition instance.
///
- public static readonly Instruction OTE = new(nameof(OTE));
+ public static Instruction OTE(Argument data_bit) => new(nameof(OTE), "OTE(data_bit)", data_bit);
///
/// Gets the OTL instruction definition instance.
///
- public static readonly Instruction OTL = new(nameof(OTL));
+ public static Instruction OTL(Argument data_bit) => new(nameof(OTL), "OTL(data_bit)", data_bit);
///
/// Gets the OTU instruction definition instance.
///
- public static readonly Instruction OTU = new(nameof(OTU));
+ public static Instruction OTU(Argument data_bit) => new(nameof(OTU), "OTU(data_bit)", data_bit);
///
/// Gets the PATT instruction definition instance.
///
- public static readonly Instruction PATT = new(nameof(PATT));
+ public static Instruction PATT(Argument phase_name, Argument result) =>
+ new(nameof(PATT), "PATT(phase_name,result)", phase_name, result);
///
/// Gets the PCLF instruction definition instance.
///
- public static readonly Instruction PCLF = new(nameof(PCLF));
+ public static Instruction PCLF(Argument phase_name) => new(nameof(PCLF), "PCLF(phase_name)", phase_name);
///
/// Gets the PCMD instruction definition instance.
///
- public static readonly Instruction PCMD = new(nameof(PCMD));
+ public static Instruction PCMD(Argument phase_name, Argument command, Argument result) =>
+ new(nameof(PCMD), "PCMD(phase_name,command,result)", phase_name, command, result);
///
/// Gets the PDET instruction definition instance.
///
- public static readonly Instruction PDET = new(nameof(PDET));
+ public static Instruction PDET(Argument phase_name) => new(nameof(PDET), "PDET(phase_name)", phase_name);
///
/// Gets the PFL instruction definition instance.
///
- public static readonly Instruction PFL = new(nameof(PFL));
+ public static Instruction PFL(Argument source) => new(nameof(PFL), "PFL(source)", source);
///
/// Gets the PID instruction definition instance.
///
- public static readonly Instruction PID = new(nameof(PID));
+ public static Instruction PID(Argument PID, Argument process_variable, Argument tieback, Argument control_variable,
+ Argument pid_master_loop, Argument inhold_bit, Argument inhold_value) => new(nameof(PID),
+ "PID(PID,process_variable,tieback,control_variable,pid_master_loop,inhold_bit,inhold_value)", PID,
+ process_variable, tieback, control_variable, pid_master_loop, inhold_bit, inhold_value);
///
/// Gets the POVR instruction definition instance.
///
- public static readonly Instruction POVR = new(nameof(POVR));
+ public static Instruction POVR(Argument phase_name, Argument command, Argument result) =>
+ new(nameof(POVR), "POVR(phase_name,command,result)", phase_name, command, result);
///
/// Gets the PPD instruction definition instance.
///
- public static readonly Instruction PPD = new(nameof(PPD));
+ public static Instruction PPD() => new(nameof(PPD), "PPD()");
///
/// Gets the PRNP instruction definition instance.
///
- public static readonly Instruction PRNP = new(nameof(PRNP));
+ public static Instruction PRNP() => new(nameof(PRNP), "PRNP()");
///
/// Gets the PSC instruction definition instance.
///
- public static readonly Instruction PSC = new(nameof(PSC));
+ public static Instruction PSC() => new(nameof(PSC), "PSC()");
///
/// Gets the PXRQ instruction definition instance.
///
- public static readonly Instruction PXRQ = new(nameof(PXRQ));
+ public static Instruction PXRQ(Argument phase_instruction, Argument external_request, Argument data_value) =>
+ new(nameof(PXRQ), "PXRQ(phase_instruction,external_request,data_value)", phase_instruction, external_request,
+ data_value);
///
/// Gets the RAD instruction definition instance.
///
- public static readonly Instruction RAD = new(nameof(RAD));
+ public static Instruction RAD(Argument source, Argument destination) =>
+ new(nameof(RAD), "RAD(source,destination)", source, destination);
///
/// Gets the RES instruction definition instance.
///
- public static readonly Instruction RES = new(nameof(RES));
+ public static Instruction RES(Argument structure) => new(nameof(RES), "RES(structure)", structure);
///
/// Gets the RET instruction definition instance.
///
- public static readonly Instruction RET = new(nameof(RET));
+ public static Instruction RET(params Argument[] outputs) => new(nameof(RET), "RET(return_1,return_n)", outputs);
///
/// Gets the RIN instruction definition instance.
///
- public static readonly Instruction RIN = new(nameof(RIN));
+ public static Instruction RIN(Argument rin_tag, Argument reset_type, Argument channel_A, Argument channel_B,
+ Argument circuit_reset, Argument fault_reset) => new(nameof(RIN),
+ "RIN(rin_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", rin_tag, reset_type, channel_A,
+ channel_B, circuit_reset, fault_reset);
///
/// Gets the ROUT instruction definition instance.
///
- public static readonly Instruction ROUT = new(nameof(ROUT));
+ public static Instruction ROUT(Argument rout_tag, Argument feedback_type, Argument enable, Argument feedback_1,
+ Argument feedback_2, Argument fault_reset) => new(nameof(ROUT),
+ "ROUT(rout_tag,feedback_type,enable,feedback_1,feedback_2,fault_reset)", rout_tag, feedback_type, enable,
+ feedback_1, feedback_2, fault_reset);
///
/// Gets the RTO instruction definition instance.
///
- public static readonly Instruction RTO = new(nameof(RTO));
+ public static Instruction RTO(Argument timer, Argument preset, Argument accum) =>
+ new(nameof(RTO), "RTO(timer,preset,accum)", timer, preset, accum);
///
/// Gets the RTOS instruction definition instance.
///
- public static readonly Instruction RTOS = new(nameof(RTOS));
+ public static Instruction RTOS(Argument source, Argument destination) =>
+ new(nameof(RTOS), "RTOS(source,destination)", source, destination);
///
/// Gets the SBR instruction definition instance.
///
- public static readonly Instruction SBR = new(nameof(SBR));
+ public static Instruction SBR(params Argument[] inputs) => new(nameof(SBR), "SBR(input_1,input_n)", inputs);
///
/// Gets the SFP instruction definition instance.
///
- public static readonly Instruction SFP = new(nameof(SFP));
+ public static Instruction SFP(Argument SFC_routine_name, Argument target_state) =>
+ new(nameof(SFP), "SFP(SFC_routine_name,target_state)", SFC_routine_name, target_state);
///
/// Gets the SFR instruction definition instance.
///
- public static readonly Instruction SFR = new(nameof(SFR));
+ public static Instruction SFR(Argument SFC_routine_name, Argument step_name) => new(nameof(SFR),
+ "SFR(SFC_routine_name,step_name)", SFC_routine_name, step_name);
///
/// Gets the SIN instruction definition instance.
///
- public static readonly Instruction SIN = new(nameof(SIN));
+ public static Instruction SIN(Argument source, Argument destination) =>
+ new(nameof(SIN), "SIN(source,destination)", source, destination);
///
/// Gets the SIZE instruction definition instance.
///
- public static readonly Instruction SIZE = new(nameof(SIZE));
+ public static Instruction SIZE(Argument souce, Argument dimension_to_vary, Argument size) =>
+ new(nameof(SIZE), "SIZE(souce,dimension_to_vary,size)", souce, dimension_to_vary, size);
///
/// Gets the SMAT instruction definition instance.
///
- public static readonly Instruction SMAT = new(nameof(SMAT));
+ public static Instruction SMAT(Argument smat_tag, Argument restart_type, Argument short_circuit_detect_delay_time,
+ Argument channel_A, Argument channel_B, Argument input_status, Argument reset) => new(nameof(SMAT),
+ "SMAT(smat_tag,restart_type,short_circuit_detect_delay_time,channel_A,channel_B,input_status,reset)", smat_tag,
+ restart_type, short_circuit_detect_delay_time, channel_A, channel_B, input_status, reset);
///
/// Gets the SQI instruction definition instance.
///
- public static readonly Instruction SQI = new(nameof(SQI));
+ public static Instruction SQI(Argument array, Argument mask, Argument source, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(SQI), "SQI(array,mask,source,control,length,position)", array, mask, source, control, length,
+ position);
///
/// Gets the SQL instruction definition instance.
///
- public static readonly Instruction SQL = new(nameof(SQL));
+ public static Instruction SQL(Argument array, Argument source, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(SQL), "SQL(array,source,control,length,position)", array, source, control, length, position);
///
/// Gets the SQO instruction definition instance.
///
- public static readonly Instruction SQO = new(nameof(SQO));
+ public static Instruction SQO(Argument array, Argument mask, Argument destination, Argument control,
+ Argument length, Argument position) =>
+ new(nameof(SQO), "SQO(array,mask,destination,control,length,position)", array, mask, destination, control,
+ length, position);
///
/// Gets the SQR instruction definition instance.
///
- public static readonly Instruction SQR = new(nameof(SQR));
+ public static Instruction SQR(Argument source, Argument destination) =>
+ new(nameof(SQR), "SQR(source,destination)", source, destination);
///
/// Gets the SRT instruction definition instance.
///
- public static readonly Instruction SRT = new(nameof(SRT));
+ public static Instruction SRT(Argument array, Argument dim_to_vary, Argument control, Argument length,
+ Argument position) =>
+ new(nameof(SRT), "SRT(array,dim_to_vary,control,length,position)", array, dim_to_vary, control, length,
+ position);
///
/// Gets the SSV instruction definition instance.
///
- public static readonly Instruction SSV = new(nameof(SSV));
+ public static Instruction SSV(Argument class_name, Argument instance_name, Argument attribute_name,
+ Argument source) =>
+ new(nameof(SSV), "SSV(class_name,instance_name,attribute_name,source)", class_name, instance_name,
+ attribute_name, source);
///
/// Gets the STD instruction definition instance.
///
- public static readonly Instruction STD = new(nameof(STD));
+ public static Instruction STD(Argument array, Argument dim_to_vary, Argument destination, Argument control,
+ Argument length, Argument position) => new(nameof(STD),
+ "STD(array,dim_to_vary,destination,control,length,position)", array, dim_to_vary, destination, control, length,
+ position);
///
/// Gets the STOD instruction definition instance.
///
- public static readonly Instruction STOD = new(nameof(STOD));
+ public static Instruction STOD(Argument source, Argument destination) =>
+ new(nameof(STOD), "STOD(source,destination)", source, destination);
///
/// Gets the STOR instruction definition instance.
///
- public static readonly Instruction STOR = new(nameof(STOR));
+ public static Instruction STOR(Argument source, Argument destination) =>
+ new(nameof(STOR), "STOR(source,destination)", source, destination);
///
/// Gets the SUB instruction definition instance.
///
- public static readonly Instruction SUB = new(nameof(SUB));
+ public static Instruction SUB(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(SUB), "SUB(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the SWPB instruction definition instance.
///
- public static readonly Instruction SWPB = new(nameof(SWPB));
+ public static Instruction SWPB(Argument source, Argument order_mode, Argument destination) =>
+ new(nameof(SWPB), "SWPB(source,order_mode,destination)", source, order_mode, destination);
///
/// Gets the TAN instruction definition instance.
///
- public static readonly Instruction TAN = new(nameof(TAN));
+ public static Instruction TAN(Argument source, Argument destination) =>
+ new(nameof(TAN), "TAN(source,destination)", source, destination);
///
/// Gets the THRS instruction definition instance.
///
- public static readonly Instruction THRS = new(nameof(THRS));
+ public static Instruction THRS(Argument thrs_tag, Argument active_pin_type, Argument active_pin,
+ Argument right_button_normally_open, Argument right_button_normally_closed, Argument left_button_normally_open,
+ Argument left_button_normally_closed, Argument fault_reset) => new(nameof(THRS),
+ "THRS(thrs_tag,active_pin_type,active_pin,right_button_normally_open,right_button_normally_closed,left_button_normally_open,left_button_normally_closed,fault_reset)",
+ thrs_tag, active_pin_type, active_pin, right_button_normally_open, right_button_normally_closed,
+ left_button_normally_open, left_button_normally_closed, fault_reset);
///
/// Gets the THRSE instruction definition instance.
///
- public static readonly Instruction THRSE = new(nameof(THRSE));
+ public static Instruction THRSE(Argument thrse_tag, Argument discprepancy_time, Argument enable,
+ Argument disconnected, Argument right_button_normally_open, Argument right_button_normally_closed,
+ Argument left_button_normally_open, Argument left_button_normally_closed, Argument input_status,
+ Argument resest) => new(nameof(THRSE),
+ "THRSE(thrse_tag,discprepancy_time,enable,disconnected,right_button_normally_open,right_button_normally_closed,left_button_normally_open,left_button_normally_closed,input_status,resest)",
+ thrse_tag, discprepancy_time, enable, disconnected, right_button_normally_open, right_button_normally_closed,
+ left_button_normally_open, left_button_normally_closed, input_status, resest);
///
/// Gets the TND instruction definition instance.
///
- public static readonly Instruction TND = new(nameof(TND));
+ public static Instruction TND() => new(nameof(TND), "TND()");
///
/// Gets the TOD instruction definition instance.
///
- public static readonly Instruction TOD = new(nameof(TOD));
+ public static Instruction TOD(Argument source, Argument destination) =>
+ new(nameof(TOD), "TOD(source,destination)", source, destination);
///
/// Gets the TOF instruction definition instance.
///
- public static readonly Instruction TOF = new(nameof(TOF));
+ public static Instruction TOF(Argument timer, Argument preset, Argument accum) =>
+ new(nameof(TOF), "TOF(timer,preset,accum)", timer, preset, accum);
///
/// Gets the TON instruction definition instance.
///
- public static readonly Instruction TON = new(nameof(TON));
+ public static Instruction TON(Argument timer, Argument preset, Argument accum) =>
+ new(nameof(TON), "TON(timer,preset,accum)", timer, preset, accum);
///
/// Gets the TRN instruction definition instance.
///
- public static readonly Instruction TRN = new(nameof(TRN));
+ public static Instruction TRN(Argument source, Argument destination) =>
+ new(nameof(TRN), "TRN(source,destination)", source, destination);
///
/// Gets the TSAM instruction definition instance.
///
- public static readonly Instruction TSAM = new(nameof(TSAM));
+ public static Instruction TSAM(Argument tsam_tag, Argument restart_type, Argument S1_S2_time, Argument S2_LC_time,
+ Argument maximum_mute_time, Argument maximum_override_time, Argument light_curtain, Argument sensor_1,
+ Argument sensor_2, Argument enable_mute, Argument @override, Argument input_status, Argument muting_lamp_status,
+ Argument reset) => new(nameof(TSAM),
+ "TSAM(tsam_tag,restart_type,S1_S2_time,S2_LC_time,maximum_mute_time,maximum_override_time,light_curtain,sensor_1,sensor_2,enable_mute,override,input_status,muting_lamp_status,reset)",
+ tsam_tag, restart_type, S1_S2_time, S2_LC_time, maximum_mute_time, maximum_override_time, light_curtain,
+ sensor_1, sensor_2, enable_mute, @override, input_status, muting_lamp_status, reset);
///
/// Gets the TSSM instruction definition instance.
///
- public static readonly Instruction TSSM = new(nameof(TSSM));
+ public static Instruction TSSM(Argument tssm_tag, Argument restart_type, Argument S1_S2_discrepancy_time,
+ Argument S1_S2_LC_minimum_time, Argument S1_S2_LC_maximum_time, Argument maximum_mute_time,
+ Argument maximum_override_time, Argument light_curtain, Argument sensor_1, Argument sensor_2,
+ Argument enable_mute, Argument @override, Argument input_status, Argument muting_lamp_status, Argument reset) =>
+ new(nameof(TSSM),
+ "TSSM(tssm_tag,restart_type,S1_S2_discrepancy_time,S1_S2_LC_minimum_time,S1_S2_LC_maximum_time,maximum_mute_time,maximum_override_time,light_curtain,sensor_1,sensor_2,enable_mute,override,input_status,muting_lamp_status,reset)",
+ tssm_tag, restart_type, S1_S2_discrepancy_time, S1_S2_LC_minimum_time, S1_S2_LC_maximum_time,
+ maximum_mute_time, maximum_override_time, light_curtain, sensor_1, sensor_2, enable_mute, @override,
+ input_status, muting_lamp_status, reset);
///
/// Gets the UID instruction definition instance.
///
- public static readonly Instruction UID = new(nameof(UID));
+ public static Instruction UID() => new(nameof(UID), "UID()");
///
/// Gets the UIE instruction definition instance.
///
- public static readonly Instruction UIE = new(nameof(UIE));
+ public static Instruction UIE() => new(nameof(UIE), "UIE()");
///
/// Gets the UPPER instruction definition instance.
///
- public static readonly Instruction UPPER = new(nameof(UPPER));
+ public static Instruction UPPER(Argument source, Argument destination) =>
+ new(nameof(UPPER), "UPPER(source,destination)", source, destination);
///
- /// Gets the XIC instruction definition instance.
+ /// Creates a new XIC instruction instance with the predeinfed signature and provided instruction arguments.
///
- public static readonly Instruction XIC = new(nameof(XIC));
+ /// A new with initialized key, signature, and arguments.
+ ///
+ /// Note that this instruction method signature was extracted from the Rockwell L5X documentation.
+ /// Each instruction will take the set of matching the instruction signature.
+ /// It is up to the caller to know whether these can be immediate value arguments or tag name reference arguments.
+ ///
+ public static Instruction XIC(Argument data_bit) => new(nameof(XIC), "XIC(data_bit)", data_bit);
///
/// Gets the XIO instruction definition instance.
///
- public static readonly Instruction XIO = new(nameof(XIO));
+ public static Instruction XIO(Argument data_bit) => new(nameof(XIO), "XIO(data_bit)", data_bit);
///
/// Gets the XOR instruction definition instance.
///
- public static readonly Instruction XOR = new(nameof(XOR));
+ public static Instruction XOR(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(XOR), "XOR(source_A,source_B,destination)", source_A, source_B, destination);
///
/// Gets the XPY instruction definition instance.
///
- public static readonly Instruction XPY = new(nameof(XPY));
+ public static Instruction XPY(Argument source_A, Argument source_B, Argument destination) =>
+ new(nameof(XPY), "XPY(source_A,source_B,destination)", source_A, source_B, destination);
#endregion
-
+
///
- /// List of known instrcution keys to used to determine if a given instruction is destructive.
+ /// Creates some default arg names for a provided number of arguments.
///
- private static List ConditionalKeys() => new()
+ private static string DefaultArgs(int number)
{
- nameof(CMP), nameof(EQU), nameof(GEQ), nameof(GRT),nameof(LEQ), nameof(LES),
- nameof(LIM), nameof(MEQ), nameof(NEQ), nameof(XIC),nameof(XIO)
- };
+ return string.Join(',', Enumerable.Range(0, number).Select(i => $"arg{i}"));
+ }
///
- /// Lazy list of all known instructions.
+ /// Lazy list of all known instructions and their corresponding factory method function.
///
- private static Lazy> _known =>
- new(() => GetInstructionFields().ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase),
- LazyThreadSafetyMode.ExecutionAndPublication);
+ private static Lazy>> _known =>
+ new(() => GetFactories().ToDictionary(x => x.Key, x => x.Value), LazyThreadSafetyMode.ExecutionAndPublication);
///
- /// Returns all defined instructions members for the provided type.
+ /// Indexes all instruction factory methods in the class and creates a function returning the instruction
+ /// mathcing the specified key or method name. The method is passed null argumnts and therefore will be a default
+ /// instruction instance. Callers can then use to pass argument array.
///
- private static IEnumerable GetInstructionFields()
+ private static IEnumerable>> GetFactories()
{
- var type = typeof(Instruction);
+ var methods = typeof(Instruction).GetMethods(BindingFlags.Public | BindingFlags.Static)
+ .Where(m => m.ReturnType == typeof(Instruction) && m.Name.All(char.IsUpper));
- return type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
- .Where(f => type.IsAssignableFrom(f.FieldType))
- .Select(f => (Instruction) f.GetValue(null))
- .ToList();
+ foreach (var method in methods)
+ {
+ var arguments = method.GetParameters()
+ .Select(p => Expression.TypeAs(Expression.Constant(null), p.ParameterType));
+ var function = Expression.Call(method, arguments);
+ var lambda = Expression.Lambda>(function);
+ yield return new KeyValuePair>(method.Name, lambda.Compile());
+ }
}
}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/NeutralText.cs b/src/L5Sharp/Common/NeutralText.cs
index 34d28d2a..1cf1c35e 100644
--- a/src/L5Sharp/Common/NeutralText.cs
+++ b/src/L5Sharp/Common/NeutralText.cs
@@ -74,6 +74,14 @@ public NeutralText(string text)
/// An containing objects found in the text.
public IEnumerable Instructions() =>
Regex.Matches(_text, Instruction.Pattern).Select(m => Instruction.Parse(m.Value));
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IEnumerable Instructions(string key) =>
+ Regex.Matches(_text, Instruction.Pattern).Select(m => Instruction.Parse(m.Value)).Where(i => i.Key == key);
///
/// Returns a collection of objects that were found in the current neutral text value.
diff --git a/src/L5Sharp/Elements/Block.cs b/src/L5Sharp/Elements/Block.cs
index 02534f4a..f72175f8 100644
--- a/src/L5Sharp/Elements/Block.cs
+++ b/src/L5Sharp/Elements/Block.cs
@@ -189,23 +189,13 @@ public IEnumerable Tags
///
public override IEnumerable References()
{
- var instruction = GetInstruction();
-
- var references = new List { new(Element, L5XName.Instruction, Type, instruction) };
-
- if (Operand is not null && Operand.IsTag)
- {
- references.Add(new CrossReference(Element, L5XName.Tag, Operand.ToString(), instruction));
- }
-
- foreach (var pin in Pins)
- {
- var endpoints = Endpoints(pin);
- var refs = endpoints.Where(e => e.IsTag)
- .Select(e => new CrossReference(Element, L5XName.Tag, e.ToString(), instruction));
- references.AddRange(refs);
- }
+ var references = new List { new(Element, L5XName.Instruction, Type) };
+ if (Operand is null || !Operand.IsTag)
+ return references;
+
+ references.Add(new CrossReference(Element, L5XName.Tag, Operand.ToString(), Type));
+ references.AddRange(Tags.Select(t => new CrossReference(Element, L5XName.Tag, t, Type)));
return references;
}
@@ -977,11 +967,11 @@ private static Block NewRoutine(string type, string routine, params string[] par
return new Block(element);
}
- private IEnumerable Endpoints(string? param = null)
+ private IEnumerable> Endpoints(string? param = null)
{
- if (Sheet is null) return Enumerable.Empty();
+ if (Sheet is null) return Enumerable.Empty>();
- var arguments = new List();
+ var arguments = new List>();
arguments.AddRange(GetInputs(Sheet, param));
arguments.AddRange(GetOutputs(Sheet, param));
@@ -989,9 +979,9 @@ private IEnumerable Endpoints(string? param = null)
return arguments;
}
- private IEnumerable GetInputs(Sheet sheet, string? param)
+ private IEnumerable> GetInputs(Sheet sheet, string? param)
{
- var arguments = new List();
+ var arguments = new List>();
var inputs = sheet.Wires().Where(w => w.IsTo(ID, param));
@@ -999,16 +989,23 @@ private IEnumerable GetInputs(Sheet sheet, string? param)
{
var block = sheet.Block(wire.FromID);
if (block is null) continue;
- var args = block.GetArguments(wire.FromParam);
- arguments.AddRange(args);
+
+ if (block.Type == L5XName.OCon)
+ {
+ arguments.AddRange(GetPair()?.Endpoints() ?? Enumerable.Empty>());
+ continue;
+ }
+
+ var arg = block.GetArguments(wire.FromParam);
+ arguments.Add(new KeyValuePair(arg, block.Type));
}
return arguments;
}
- private IEnumerable GetOutputs(Sheet sheet, string? param)
+ private IEnumerable> GetOutputs(Sheet sheet, string? param)
{
- var arguments = new List();
+ var arguments = new List>();
var wires = sheet.Wires().Where(w => w.IsFrom(ID, param));
@@ -1016,26 +1013,32 @@ private IEnumerable GetOutputs(Sheet sheet, string? param)
{
var block = sheet.Block(wire.ToID);
if (block is null) continue;
- var args = block.GetArguments(wire.ToParam);
- arguments.AddRange(args);
+
+ if (block.Type == L5XName.ICon)
+ {
+ arguments.AddRange(GetPair()?.Endpoints() ?? Enumerable.Empty>());
+ continue;
+ }
+
+ var arg = block.GetArguments(wire.ToParam);
+ arguments.Add(new KeyValuePair(arg, block.Type));
}
return arguments;
}
- private IEnumerable GetArguments(string? param = null)
+ private TagName GetArguments(string? param = null)
{
- return L5XType switch
+ var operand = Operand is not null && Operand.IsTag ? new TagName(Operand.ToString()) : TagName.Empty;
+ var parameter = param is not null ? new TagName(param) : TagName.Empty;
+ return TagName.Concat(operand, parameter);
+
+ /*return L5XType switch
{
- L5XName.IRef => new[] { Operand ?? Argument.Empty },
- L5XName.ORef => new[] { Operand ?? Argument.Empty },
- L5XName.ICon => GetPair()?.Endpoints() ?? Enumerable.Empty(),
- L5XName.OCon => GetPair()?.Endpoints() ?? Enumerable.Empty(),
- L5XName.Block => new[]
- {
- Operand is not null && param is not null ? TagName.Concat(Operand.ToString(), param) : Argument.Empty
- },
- L5XName.Function => new[] { Argument.Unknown },
+ L5XName.IRef => Operand is not null && Operand.IsTag ? (TagName)Operand : TagName.Empty,
+ L5XName.ORef => Operand is not null && Operand.IsTag ? (TagName)Operand : TagName.Empty,
+ L5XName.Block => Operand is not null && param is not null ? TagName.Concat(Operand.ToString(), param) : TagName.Empty,
+ L5XName.Function => param is not null ? new TagName(param) : Argument.Empty,
L5XName.AddOnInstruction => new[]
{
Operand is not null && param is not null ? TagName.Concat(Operand.ToString(), param) : Argument.Empty
@@ -1044,7 +1047,7 @@ private IEnumerable GetArguments(string? param = null)
L5XName.SBR => new[] { param is not null ? new TagName(param) : Argument.Empty },
L5XName.RET => new[] { param is not null ? new TagName(param) : Argument.Empty },
_ => new[] { Argument.Empty }
- };
+ };*/
}
///
@@ -1052,22 +1055,5 @@ private IEnumerable GetArguments(string? param = null)
///
private Block? GetPair() => Sheet?.Blocks().FirstOrDefault(b => b.ID != ID && Equals(b.Operand, Operand));
- ///
- /// Converts the current Block into an Instruction instance to be used for referencing.
- ///
- private Instruction GetInstruction()
- {
- var instruction = new Instruction(Type, Operand ?? Argument.Empty);
-
- if (Operand is null) return instruction;
-
- foreach (var pin in Pins)
- {
- instruction = instruction.Append(TagName.Concat(Operand.ToString(), pin));
- }
-
- return instruction;
- }
-
#endregion
}
\ No newline at end of file
diff --git a/src/L5Sharp/Elements/Line.cs b/src/L5Sharp/Elements/Line.cs
index 34c5cb06..685329f5 100644
--- a/src/L5Sharp/Elements/Line.cs
+++ b/src/L5Sharp/Elements/Line.cs
@@ -49,15 +49,33 @@ public override IEnumerable References()
{
var references = new List();
- references.AddRange(Text.Tags()
- .Select(name => new CrossReference(Element, L5XName.Tag, name)));
+ foreach (var instruction in Text.Instructions())
+ {
+ references.Add(new CrossReference(Element, L5XName.Instruction, instruction.Key, instruction));
+
+ if (instruction.IsRoutineCall)
+ {
+ var routine = instruction.Arguments.FirstOrDefault()?.ToString() ?? string.Empty;
+ references.Add(new CrossReference(Element, L5XName.Routine, routine, instruction));
+
+ var parameters = instruction.Arguments.Skip(1).Where(a => a.IsTag).Select(t => t.ToString());
+ references.AddRange(parameters.Select(p => new CrossReference(Element, L5XName.Tag, p, instruction)));
+ continue;
+ }
- references.AddRange(Text.Instructions()
- .Select(instruction => new CrossReference(Element, L5XName.AddOnInstructionDefinition, instruction.Key)));
+ if (instruction.IsTaskCall)
+ {
+ var task = instruction.Arguments.FirstOrDefault()?.ToString() ?? string.Empty;
+ references.Add(new CrossReference(Element, L5XName.Task, task, instruction));
+ continue;
+ }
+
+ //todo other instructions like GSV SSV
+
+ references.AddRange(instruction.Text.Tags()
+ .Select(t => new CrossReference(Element, L5XName.Tag, t.ToString(), instruction)));
+ }
- //todo routines? Have to look for JSR and SBR, RET
- //todo modules? Have to look for tag names with ':'
-
return references;
}
diff --git a/src/L5Sharp/Elements/Rung.cs b/src/L5Sharp/Elements/Rung.cs
index 1644dfbb..e675f5a7 100644
--- a/src/L5Sharp/Elements/Rung.cs
+++ b/src/L5Sharp/Elements/Rung.cs
@@ -116,7 +116,9 @@ public override IEnumerable References()
foreach (var instruction in Text.Instructions())
{
- if (instruction.CallsRoutine)
+ references.Add(new CrossReference(Element, L5XName.Instruction, instruction.Key, instruction));
+
+ if (instruction.IsRoutineCall)
{
var routine = instruction.Arguments.FirstOrDefault()?.ToString() ?? string.Empty;
references.Add(new CrossReference(Element, L5XName.Routine, routine, instruction));
@@ -126,7 +128,7 @@ public override IEnumerable References()
continue;
}
- if (instruction.CallsTask)
+ if (instruction.IsTaskCall)
{
var task = instruction.Arguments.FirstOrDefault()?.ToString() ?? string.Empty;
references.Add(new CrossReference(Element, L5XName.Task, task, instruction));
diff --git a/tests/L5Sharp.Tests/Common/InstructionTests.cs b/tests/L5Sharp.Tests/Common/InstructionTests.cs
index 93b58162..39bcbf62 100644
--- a/tests/L5Sharp.Tests/Common/InstructionTests.cs
+++ b/tests/L5Sharp.Tests/Common/InstructionTests.cs
@@ -9,7 +9,7 @@ public class InstructionTests
[Test]
public void New_ValidKey_ShouldNotBeNull()
{
- var instruction = new Instruction("Test");
+ var instruction = Instruction.New("Test");
instruction.Should().NotBeNull();
}
@@ -17,25 +17,19 @@ public void New_ValidKey_ShouldNotBeNull()
[Test]
public void New_ValidKey_ShouldHaveExpectedDefaults()
{
- var instruction = new Instruction("Test");
-
+ var instruction = Instruction.New("Test");
+
instruction.Key.Should().Be("Test");
- instruction.Signature.Should().Be("()");
- instruction.IsConditional.Should().BeFalse();
- instruction.CallsRoutine.Should().BeFalse();
- instruction.CallsTask.Should().BeFalse();
+ instruction.Signature.Should().Be("Test()");
instruction.Arguments.Should().BeEmpty();
+ instruction.Operadns.Should().BeEmpty();
instruction.Text.Should().Be("Test()");
+ instruction.IsConditional.Should().BeFalse();
+ instruction.IsRoutineCall.Should().BeFalse();
+ instruction.IsTaskCall.Should().BeFalse();
+ instruction.IsValid.Should().BeTrue();
}
-
- [Test]
- public void Known_WhenCalled_ShouldNotBeEmpty()
- {
- var known = Instruction.Known();
- known.Should().NotBeEmpty();
- }
-
[Test]
public void Keys_WhenCalled_ShouldNotBeEmpty()
{
@@ -47,73 +41,106 @@ public void Keys_WhenCalled_ShouldNotBeEmpty()
[Test]
public void XIC_WhenCalled_ShouldBeExpectedProperties()
{
- var instruction = Instruction.XIC;
+ var instruction = Instruction.XIC("MyTag");
instruction.Key.Should().Be("XIC");
- instruction.Signature.Should().Contain("()");
+ instruction.Signature.Should().Be("XIC(data_bit)");
+ instruction.Arguments.Should().HaveCount(1);
+ instruction.Operadns.Should().HaveCount(1);
+ instruction.Text.Should().Be("XIC(MyTag)");
instruction.IsConditional.Should().BeTrue();
- instruction.CallsRoutine.Should().BeFalse();
- instruction.CallsTask.Should().BeFalse();
- instruction.Arguments.Should().BeEmpty();
- instruction.Text.Should().Be("XIC()");
+ instruction.IsRoutineCall.Should().BeFalse();
+ instruction.IsTaskCall.Should().BeFalse();
+ instruction.IsValid.Should().BeTrue();
}
-
+
[Test]
public void OTE_WhenCalled_ShouldBeExpectedProperties()
{
- var instruction = Instruction.OTE;
+ var instruction = Instruction.OTE("MyTag");
instruction.Key.Should().Be("OTE");
- instruction.Signature.Should().Contain("()");
+ instruction.Signature.Should().Contain("OTE(data_bit)");
+ instruction.Arguments.Should().HaveCount(1);
+ instruction.Operadns.Should().HaveCount(1);
+ instruction.Text.Should().Be("OTE(MyTag)");
instruction.IsConditional.Should().BeFalse();
- instruction.CallsRoutine.Should().BeFalse();
- instruction.CallsTask.Should().BeFalse();
- instruction.Arguments.Should().BeEmpty();
- instruction.Text.Should().Be("OTE()");
+ instruction.IsRoutineCall.Should().BeFalse();
+ instruction.IsTaskCall.Should().BeFalse();
+ instruction.IsValid.Should().BeTrue();
}
-
+
[Test]
- public void CallsRoutine_JSR_ShouldBeTrue()
+ public void TON_ValidArgs_ShouldHaveExpectedValues()
{
- var instruction = Instruction.JSR;
-
- instruction.CallsRoutine.Should().BeTrue();
+ var instruction = Instruction.TON("SomeTimer", 5000, 0);
+
+ instruction.Key.Should().Be("TON");
+ instruction.Signature.Should().Contain("TON(timer,preset,accum)");
+ instruction.Arguments.Should().HaveCount(3);
+ instruction.Operadns.Should().HaveCount(3);
+ instruction.Text.Should().Be("TON(SomeTimer,5000,0)");
+ instruction.IsConditional.Should().BeFalse();
+ instruction.IsRoutineCall.Should().BeFalse();
+ instruction.IsTaskCall.Should().BeFalse();
+ instruction.IsValid.Should().BeTrue();
}
-
+
[Test]
- public void CallsTask_EVENT_ShouldBeTrue()
+ public void JSR_WhenCalled_ShouldBeExpectedProperties()
{
- var instruction = Instruction.EVENT;
-
- instruction.CallsTask.Should().BeTrue();
+ var instruction = Instruction.JSR("Routine", 1, "In1", "Out1");
+
+ instruction.Key.Should().Be("JSR");
+ instruction.Signature.Should()
+ .Contain("JSR(routine_name,number_of_inputs,input_1,input_n,return_1,return_n)");
+ instruction.Arguments.Should().HaveCount(4);
+ instruction.Operadns.Should().HaveCount(6);
+ instruction.Text.Should().Be("JSR(Routine,1,In1,Out1)");
+ instruction.IsConditional.Should().BeFalse();
+ instruction.IsRoutineCall.Should().BeTrue();
+ instruction.IsTaskCall.Should().BeFalse();
+ instruction.IsValid.Should().BeTrue();
}
[Test]
- public void Of_XIC_ShouldHaveExpectedValues()
+ public void EVENT_WhenCalled_ShouldBeExpectedProperties()
{
- var instruction = Instruction.XIC.Of("MyTagKey");
+ var instruction = Instruction.EVENT("MyTask");
- instruction.Key.Should().Be("XIC");
- instruction.Signature.Should().Be("(MyTagKey)");
- instruction.IsConditional.Should().BeTrue();
- instruction.CallsRoutine.Should().BeFalse();
- instruction.CallsTask.Should().BeFalse();
+ instruction.Key.Should().Be("EVENT");
+ instruction.Signature.Should().Contain("EVENT(task)");
instruction.Arguments.Should().HaveCount(1);
- instruction.Text.Should().Be("XIC(MyTagKey)");
+ instruction.Operadns.Should().HaveCount(1);
+ instruction.Text.Should().Be("EVENT(MyTask)");
+ instruction.IsConditional.Should().BeFalse();
+ instruction.IsRoutineCall.Should().BeFalse();
+ instruction.IsTaskCall.Should().BeTrue();
+ instruction.IsValid.Should().BeTrue();
}
[Test]
- public void Of_TON_ShouldHaveExpectedValues()
+ public void Of_ValidArguments_ShouldHaveExpectedTextAndArgumentsAndBeValid()
{
- var instruction = Instruction.TON.Of("SomeTimer", 5000, 0);
+ var instruction = Instruction.XIC("MyTag");
- instruction.Key.Should().Be("TON");
- instruction.Signature.Should().Be("(SomeTimer,5000,0)");
- instruction.IsConditional.Should().BeFalse();
- instruction.CallsRoutine.Should().BeFalse();
- instruction.CallsTask.Should().BeFalse();
- instruction.Arguments.Should().HaveCount(3);
- instruction.Text.Should().Be("TON(SomeTimer,5000,0)");
+ instruction = instruction.Of("NewTag");
+
+ instruction.Arguments.Should().HaveCount(1);
+ instruction.Text.Should().Be("XIC(NewTag)");
+ instruction.IsValid.Should().BeTrue();
+ }
+
+ [Test]
+ public void Of_InvalidArgs_ShouldHaveExpectedTextAndArgumentsAndNotBeValid()
+ {
+ var instruction = Instruction.XIC("MyTag");
+
+ instruction = instruction.Of("NewTag", "InvalidTag");
+
+ instruction.Arguments.Should().HaveCount(2);
+ instruction.Text.Should().Be("XIC(NewTag,InvalidTag)");
+ instruction.IsValid.Should().BeFalse();
}
[Test]
@@ -121,6 +148,9 @@ public void Of_TON_ShouldHaveExpectedValues()
[TestCase("TON(SomeTimer,5000,0);", "TON", 3)]
[TestCase("TON(SomeTimer,?,?);", "TON", 3)]
[TestCase("CMP(ATN(_Test) > 1.0);", "CMP", 1)]
+ [TestCase("JSR(Routine,2,in1,in2,out1,out2,out3);", "JSR", 7)]
+ [TestCase("SBR(Routine,in1,in2);", "SBR", 3)]
+ [TestCase("RET(Routine,out1,out2);", "RET", 3)]
public void Parse_ValidInput_ShouldHaveExpectedKeyAndArguments(string text, string key, int args)
{
var instruction = Instruction.Parse(text);
@@ -133,47 +163,24 @@ public void Parse_ValidInput_ShouldHaveExpectedKeyAndArguments(string text, stri
[Test]
public void Parse_ExpressionTypeInput_ShouldThrowNewException()
{
- FluentActions.Invoking(() => Instruction.Parse("(SomeTag > 1.0)/100")).Should().Throw();
- }
-
- [Test]
- public void IsEquivalent_EqualInstructionSignatures_ShouldBeTrue()
- {
- var first = Instruction.XIC.Of("MyTag");
- var second = Instruction.XIC.Of("MyTag");
-
- var result = first.IsEquivalent(second);
-
- result.Should().BeTrue();
+ FluentActions.Invoking(() => Instruction.Parse("(SomeTag > 1.0)/100")).Should().Throw();
}
-
- [Test]
- public void IsEquivalent_SameKeyDifferentSignature_ShouldBeFalse()
- {
- var first = Instruction.XIC.Of("MyTag");
- var second = Instruction.XIC.Of("MyOtherTag");
-
- var result = first.IsEquivalent(second);
- result.Should().BeFalse();
- }
-
[Test]
- public void IsEquivalent_DifferentKeySameSignature_ShouldBeFalse()
+ public void GetArgument_ValidOperand_ShouldNotBeNull()
{
- var first = Instruction.XIC.Of("MyTag");
- var second = Instruction.OTE.Of("MyTag");
+ var instruction = Instruction.ADD(1, 1, "Test");
- var result = first.IsEquivalent(second);
+ var argument = instruction.GetArgument("source_B");
- result.Should().BeFalse();
+ argument.Should().NotBeNull();
}
[Test]
- public void Equals_EqualInstances_ShouldBeTrue()
+ public void Equals_AreEqual_ShouldBeTrue()
{
- var first = Instruction.XIC;
- var second = Instruction.XIC;
+ var first = Instruction.XIC("MyTag");
+ var second = Instruction.XIC("MyTag");
var result = first.Equals(second);
@@ -183,7 +190,7 @@ public void Equals_EqualInstances_ShouldBeTrue()
[Test]
public void Equals_SameInstances_ShouldBeTrue()
{
- var first = Instruction.XIC;
+ var first = Instruction.XIC("MyTag");
// ReSharper disable once EqualExpressionComparison
var result = first.Equals(first);
@@ -194,7 +201,7 @@ public void Equals_SameInstances_ShouldBeTrue()
[Test]
public void Equals_Null_ShouldBeFalse()
{
- var first = Instruction.XIC;
+ var first = Instruction.XIC("MyTag");
// ReSharper disable once EqualExpressionComparison
var result = first.Equals(null);
@@ -205,10 +212,10 @@ public void Equals_Null_ShouldBeFalse()
[Test]
public void Equals_EqualString_ShouldBeTrue()
{
- var first = Instruction.TON;
+ var first = Instruction.XIC("MyTag");
// ReSharper disable once SuspiciousTypeConversion.Global
- var result = first.Equals("TON");
+ var result = first.Equals("XIC(MyTag)");
result.Should().BeTrue();
}
@@ -216,19 +223,19 @@ public void Equals_EqualString_ShouldBeTrue()
[Test]
public void EqualsOperator_EqualInstances_ShouldBeTure()
{
- var first = Instruction.XIC;
- var second = Instruction.XIC;
+ var first = Instruction.XIC("MyTag");
+ var second = Instruction.XIC("MyTag");
var result = first == second;
result.Should().BeTrue();
}
-
+
[Test]
public void NotEqualsOperator_EqualInstances_ShouldBeFalse()
{
- var first = Instruction.XIC;
- var second = Instruction.XIC;
+ var first = Instruction.XIC("MyTag");
+ var second = Instruction.XIC("MyTag");
var result = first != second;
@@ -238,17 +245,19 @@ public void NotEqualsOperator_EqualInstances_ShouldBeFalse()
[Test]
public void GetHasCode_WhenCalled_ReturnsHasOfKey()
{
- var instruction = Instruction.XIC;
-
+ var instruction = Instruction.XIC("MyTag");
+
var result = instruction.GetHashCode();
-
- result.Should().Be(instruction.Key.GetHashCode());
+
+ result.Should().Be(instruction.Text.GetHashCode());
}
[Test]
- public void ToString_WhenCalled_ShouldBeKey()
+ public void ToString_WhenCalled_ShouldBeText()
{
- Instruction.OTE.ToString().Should().Be("OTE");
+ var text = Instruction.OTE("MyTag").ToString();
+
+ text.Should().Be("OTE(MyTag)");
}
}
}
\ No newline at end of file
diff --git a/tests/L5Sharp.Tests/Common/NeutralTextTests.cs b/tests/L5Sharp.Tests/Common/NeutralTextTests.cs
index fe5a4851..09de5210 100644
--- a/tests/L5Sharp.Tests/Common/NeutralTextTests.cs
+++ b/tests/L5Sharp.Tests/Common/NeutralTextTests.cs
@@ -1,5 +1,4 @@
-using System.Text;
-using AutoFixture;
+using AutoFixture;
using FluentAssertions;
using L5Sharp.Common;
@@ -174,7 +173,7 @@ public void InstructionsBy_WithExistingInstructionPresent_ShouldContainExpectedT
var text = new NeutralText(
"[XIC(Tag.Status.Active),XIC(Tag.Status.Enabled)][MOV(15000,Timer.PRE),TON(Timer,?,?)];");
- var result = text.Instructions(Instruction.XIC).ToList();
+ var result = text.Instructions("XIC").ToList();
result.Should().Contain("XIC(Tag.Status.Active)");
result.Should().Contain("XIC(Tag.Status.Enabled)");
@@ -186,9 +185,9 @@ public void InstructionsBy_WithExistingInstructionPresent_ShouldHaveExpectedCoun
var text = new NeutralText(
"[XIC(Tag.Status.Active),XIC(Tag.Status.Enabled)][MOV(15000,Timer.PRE),TON(Timer,?,?)];");
- var result = text.Instructions(Instruction.XIC);
+ var result = text.Instructions(Instruction.XIC("Tag.Status.Active"));
- result.Should().HaveCount(2);
+ result.Should().HaveCount(1);
}
[Test]
@@ -226,22 +225,11 @@ public void TagsIn_OTE_ShouldHaveExpectedTagName()
{
var text = new NeutralText("[XIC(SomeBit),XIO(AnotherBit)]OTE(OutputBit);");
- var tagNames = text.TagsIn(Instruction.OTE);
+ var tagNames = text.TagsIn("OTE");
tagNames.Should().HaveCount(1);
}
- [Test]
- public void HasPattern_ConcatenatedXICOTE_ShouldBeTrue()
- {
- var text = new NeutralText(
- "[XIC(Input_Data.Pt00.Data)OTE(Ch0.ChData),XIC(Input_Data.Pt00.Fault)OTE(Ch0.ChFault)];");
-
- var result = text.HasPattern(string.Concat(Instruction.XIC.Signature, Instruction.OTE.Signature));
-
- result.Should().BeTrue();
- }
-
[Test]
public void StructuredText_New_ShouldNotBeNull()
{
diff --git a/tests/L5Sharp.Tests/ProofTesting.cs b/tests/L5Sharp.Tests/ProofTesting.cs
index 042b33e9..b1e293a4 100644
--- a/tests/L5Sharp.Tests/ProofTesting.cs
+++ b/tests/L5Sharp.Tests/ProofTesting.cs
@@ -1,5 +1,9 @@
using System.Diagnostics;
+using System.Linq.Expressions;
+using System.Reflection;
using FluentAssertions;
+using L5Sharp.Common;
+using L5Sharp.Components;
using L5Sharp.Elements;
using L5Sharp.Samples;
@@ -13,10 +17,10 @@ public void HowLongDoesThisShitTake()
{
var content = L5X.Load(Known.LotOfTags);
var element = content.Serialize();
-
+
var stopwatch = new Stopwatch();
stopwatch.Start();
-
+
stopwatch.Stop();
Console.WriteLine($"Elapsed: {stopwatch.ElapsedMilliseconds}");
}
@@ -27,18 +31,44 @@ public void Scratch()
var content = Logix.Load(Known.Test);
var sheet = content.Query().First();
- var references = sheet.References().ToList();
+ var references = sheet.References().Where(c => c.Type == nameof(Tag)).ToList();
references.Should().NotBeEmpty();
}
+ [Test]
+ public void GetInstructionMethods()
+ {
+
+
+
+ var type = typeof(Instruction);
+
+ var method = type.GetMethods(BindingFlags.Public | BindingFlags.Static)
+ .FirstOrDefault(m => m.ReturnType == typeof(Instruction) && m.Name == "XIO");
+
+ var parameter = Expression.Parameter(typeof(Argument[]), "args");
+
+ var function = Expression.Call(method!, parameter);
+
+ var factory = Expression.Lambda>(function, parameter);
+
+ var instruction = factory.Compile().Invoke(new Argument[]{"MyTagName"});
+
+ instruction.Should().NotBeNull();
+ instruction.Key.Should().Be("XIO");
+ instruction.Signature.Should().Be("XIO(data_bit);");
+ instruction.Text.Should().Be("XIO(MyTagName)");
+ instruction.Arguments.Should().HaveCount(1);
+ }
+
[Test]
public void Query()
{
var content = L5X.Load(Known.Example);
var test = content.Query().ToList().First();
-
+
var parent = test.Parent;
parent.Should().NotBeNull();