From bee6e5316caf0eba76fcf9dbe8ca92cf4964e8c2 Mon Sep 17 00:00:00 2001 From: rajeev Date: Wed, 11 Dec 2024 19:01:27 +0530 Subject: [PATCH] handeling blockType parameter for setblock() command fixing node[N].defbuffer1 and node[N].defbuffer2 not available in node configurations making sure that node[N].execute(), node[N].getglobal() and node[N].setglobal() is only available with node --- Json_parser/Program.cs | 59 ++++++-- .../StaticLuaDefinations/2450/defbuffers.lua | 5 - .../StaticLuaDefinations/2450/setBlock.lua | 6 - .../2450/triggerBlockBranch.lua | 47 ------ .../StaticLuaDefinations/2460/defbuffers.lua | 5 - .../StaticLuaDefinations/2460/setBlock.lua | 6 - .../2460/triggerBlockBranch.lua | 47 ------ .../StaticLuaDefinations/2461/defbuffers.lua | 5 - .../StaticLuaDefinations/2461/setBlock.lua | 6 - .../2461/triggerBlockBranch.lua | 47 ------ .../StaticLuaDefinations/2470/defbuffers.lua | 5 - .../StaticLuaDefinations/2470/setBlock.lua | 6 - .../2470/triggerBlockBranch.lua | 47 ------ Json_parser/Utility.cs | 137 +++++++++++++++++- helpers/HelperFunctions.py | 7 - 15 files changed, 180 insertions(+), 255 deletions(-) delete mode 100644 Json_parser/StaticLuaDefinations/2450/defbuffers.lua delete mode 100644 Json_parser/StaticLuaDefinations/2450/setBlock.lua delete mode 100644 Json_parser/StaticLuaDefinations/2450/triggerBlockBranch.lua delete mode 100644 Json_parser/StaticLuaDefinations/2460/defbuffers.lua delete mode 100644 Json_parser/StaticLuaDefinations/2460/setBlock.lua delete mode 100644 Json_parser/StaticLuaDefinations/2460/triggerBlockBranch.lua delete mode 100644 Json_parser/StaticLuaDefinations/2461/defbuffers.lua delete mode 100644 Json_parser/StaticLuaDefinations/2461/setBlock.lua delete mode 100644 Json_parser/StaticLuaDefinations/2461/triggerBlockBranch.lua delete mode 100644 Json_parser/StaticLuaDefinations/2470/defbuffers.lua delete mode 100644 Json_parser/StaticLuaDefinations/2470/setBlock.lua delete mode 100644 Json_parser/StaticLuaDefinations/2470/triggerBlockBranch.lua diff --git a/Json_parser/Program.cs b/Json_parser/Program.cs index 74ebf31..38ec99a 100644 --- a/Json_parser/Program.cs +++ b/Json_parser/Program.cs @@ -63,20 +63,24 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path) } var factoryScriptCommands = cmdList.Where(cmd => cmd.description.Contains("factory script")).ToList(); // get factoryScriptCommands and remove it, its there for 26xx models - cmdList = cmdList.Except(factoryScriptCommands).ToList(); // remove all factoryScriptCommands commands var directFunctioncommands = cmdList.Where(cmd => !cmd.name.Contains('.')).ToList(); + cmdList = cmdList.Except(directFunctioncommands).ToList(); // remove all directFunctioncommands commands and handle it speratley + var triggerModelLoadCommands = cmdList.Where(cmd => cmd.name.Contains("trigger.model.load()")).ToList(); // get trigger.model.load() commands + cmdList = cmdList.Except(triggerModelLoadCommands).ToList(); // remove all trigger.model.load() commands and handle it speratley - var triggerBlockConstants = cmdList.Where(cmd => cmd.name.Contains("trigger.BLOCK_")).ToList(); - cmdList = cmdList.Except(triggerBlockConstants).ToList(); + var triggerModelSetblockCommands = cmdList.Where(cmd => cmd.name.Contains("trigger.model.setblock()")).ToList(); + cmdList = cmdList.Except(triggerModelSetblockCommands).ToList(); + var commad_only_for_tspLinkNodes = cmdList.Where(cmd => cmd.name.Contains("node[N].")).ToList(); + cmdList = cmdList.Except(commad_only_for_tspLinkNodes).ToList(); - cmdList = cmdList.Except(directFunctioncommands).ToList(); // remove all directFunctioncommands commands and handle it speratley - cmdList = cmdList.Except(triggerModelLoadCommands).ToList(); // remove all trigger.model.load() commands and handle it speratley + + foreach (var cmd in cmdList) @@ -129,28 +133,54 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path) outStr += header; tsplinkStr += header; } + outStr += "\n" + get_trigger_load_cmd_signature(); + tsplinkStr += "\n" + get_trigger_load_cmd_signature(true); + } + + if (triggerModelSetblockCommands.Count > 0) + { + var defStr = @" +---This is generic function to define trigger model setblock. +---Signature of this function depends on the BlockType. +---For more details, please keep scrolling to find the required function signature for specific BlockType +---"; + outStr += $"{get_BlockType_alias()}"+defStr; + tsplinkStr += $"{get_BlockType_alias(true)}" + defStr; + + foreach (var cmd in triggerModelSetblockCommands) + { + var header = Utility.get_command_header(cmd, file_name); + outStr += header; + tsplinkStr += header; + } - var sig = "\n" + @"---@param loadFunConst loadFunConstParam -function trigger.model.load(loadFunConst,...) end"; - outStr += sig; - tsplinkStr += sig; + outStr += get_trigger_model_setBlock_cmd_signature(); + tsplinkStr += get_trigger_model_setBlock_cmd_signature(true); + } + if (commad_only_for_tspLinkNodes.Count > 0) + { + foreach (var cmd in commad_only_for_tspLinkNodes) + { + var cmd_info = new KeyValuePair(cmd.name.Split('.')[1], cmd); + tsplinkStr += Utility.HelpContent(cmd_info, file_name, "", false, true); + } } - + if (file_name.Contains("26")) { - + // Add specific handling for 26 models if needed } - else if (file_name.Contains("37")) { + // Add specific handling for 37 models if needed } else // for tti models { - - + outStr += get_def_buffer_definations(); + tsplinkStr += get_def_buffer_definations(true); } Directory.CreateDirectory(Path.Combine(base_lib_dir, model)); @@ -158,7 +188,6 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path) Directory.CreateDirectory(Path.Combine(base_lib_dir, model, "AllTspCommands")); Directory.CreateDirectory(Path.Combine(base_lib_dir, model, "Helper")); - var AllTspCommandsFilePath = $"{base_lib_dir}/{model}/AllTspCommands/definitions.lua"; var tspLinkSupportedCommandsFilePath = $"{base_lib_dir}/{model}/tspLinkSupportedCommands/definitions.txt"; diff --git a/Json_parser/StaticLuaDefinations/2450/defbuffers.lua b/Json_parser/StaticLuaDefinations/2450/defbuffers.lua deleted file mode 100644 index 502deed..0000000 --- a/Json_parser/StaticLuaDefinations/2450/defbuffers.lua +++ /dev/null @@ -1,5 +0,0 @@ ----@type bufferVar -defbuffer1 = {} - ----@type bufferVar -defbuffer2 = {} \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2450/setBlock.lua b/Json_parser/StaticLuaDefinations/2450/setBlock.lua deleted file mode 100644 index fa7718b..0000000 --- a/Json_parser/StaticLuaDefinations/2450/setBlock.lua +++ /dev/null @@ -1,6 +0,0 @@ ----This is generic function to define trigger model setblock.
----Signature of this function depends on the BlockType.
----For more details, please look at the manual by viewing hover help of blockType or opening command help ----@param blockNumber integer ----@param blockType triggerBlockBranch -function trigger.model.setblock(blockNumber, blockType,...) end \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2450/triggerBlockBranch.lua b/Json_parser/StaticLuaDefinations/2450/triggerBlockBranch.lua deleted file mode 100644 index 560b7bd..0000000 --- a/Json_parser/StaticLuaDefinations/2450/triggerBlockBranch.lua +++ /dev/null @@ -1,47 +0,0 @@ ----@meta - -trigger.BLOCK_BRANCH_ALWAYS= nil -trigger.BLOCK_BRANCH_COUNTER= nil -trigger.BLOCK_BRANCH_DELTA= nil -trigger.BLOCK_BRANCH_LIMIT_CONSTANT= nil -trigger.BLOCK_BRANCH_LIMIT_DYNAMIC= nil -trigger.BLOCK_BRANCH_ON_EVENT= nil -trigger.BLOCK_BRANCH_ONCE= nil -trigger.BLOCK_BRANCH_ONCE_EXCLUDED= nil -trigger.BLOCK_BUFFER_CLEAR= nil -trigger.BLOCK_CONFIG_NEXT= nil -trigger.BLOCK_CONFIG_PREV= nil -trigger.BLOCK_CONFIG_RECALL= nil -trigger.BLOCK_DELAY_CONSTANT= nil -trigger.BLOCK_DELAY_DYNAMIC= nil -trigger.BLOCK_DIGITAL_IO= nil -trigger.BLOCK_LOG_EVENT= nil -trigger.BLOCK_MEASURE_DIGITIZE= nil -trigger.BLOCK_NOP= nil -trigger.BLOCK_NOTIFY= nil -trigger.BLOCK_RESET_BRANCH_COUNT= nil -trigger.BLOCK_WAIT= nil - - ----@alias triggerBlockBranch ----| `trigger.BLOCK_BRANCH_ALWAYS` ----| `trigger.BLOCK_BRANCH_COUNTER` ----| `trigger.BLOCK_BRANCH_DELTA` ----| `trigger.BLOCK_BRANCH_LIMIT_CONSTANT` ----| `trigger.BLOCK_BRANCH_LIMIT_DYNAMIC` ----| `trigger.BLOCK_BRANCH_ON_EVENT` ----| `trigger.BLOCK_BRANCH_ONCE` ----| `trigger.BLOCK_BRANCH_ONCE_EXCLUDED` ----| `trigger.BLOCK_BUFFER_CLEAR` ----| `trigger.BLOCK_CONFIG_NEXT` ----| `trigger.BLOCK_CONFIG_PREV` ----| `trigger.BLOCK_CONFIG_RECALL` ----| `trigger.BLOCK_DELAY_CONSTANT` ----| `trigger.BLOCK_DELAY_DYNAMIC` ----| `trigger.BLOCK_DIGITAL_IO` ----| `trigger.BLOCK_LOG_EVENT` ----| `trigger.BLOCK_MEASURE_DIGITIZE` ----| `trigger.BLOCK_NOP` ----| `trigger.BLOCK_NOTIFY` ----| `trigger.BLOCK_RESET_BRANCH_COUNT` ----| `trigger.BLOCK_WAIT` diff --git a/Json_parser/StaticLuaDefinations/2460/defbuffers.lua b/Json_parser/StaticLuaDefinations/2460/defbuffers.lua deleted file mode 100644 index 502deed..0000000 --- a/Json_parser/StaticLuaDefinations/2460/defbuffers.lua +++ /dev/null @@ -1,5 +0,0 @@ ----@type bufferVar -defbuffer1 = {} - ----@type bufferVar -defbuffer2 = {} \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2460/setBlock.lua b/Json_parser/StaticLuaDefinations/2460/setBlock.lua deleted file mode 100644 index fa7718b..0000000 --- a/Json_parser/StaticLuaDefinations/2460/setBlock.lua +++ /dev/null @@ -1,6 +0,0 @@ ----This is generic function to define trigger model setblock.
----Signature of this function depends on the BlockType.
----For more details, please look at the manual by viewing hover help of blockType or opening command help ----@param blockNumber integer ----@param blockType triggerBlockBranch -function trigger.model.setblock(blockNumber, blockType,...) end \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2460/triggerBlockBranch.lua b/Json_parser/StaticLuaDefinations/2460/triggerBlockBranch.lua deleted file mode 100644 index 560b7bd..0000000 --- a/Json_parser/StaticLuaDefinations/2460/triggerBlockBranch.lua +++ /dev/null @@ -1,47 +0,0 @@ ----@meta - -trigger.BLOCK_BRANCH_ALWAYS= nil -trigger.BLOCK_BRANCH_COUNTER= nil -trigger.BLOCK_BRANCH_DELTA= nil -trigger.BLOCK_BRANCH_LIMIT_CONSTANT= nil -trigger.BLOCK_BRANCH_LIMIT_DYNAMIC= nil -trigger.BLOCK_BRANCH_ON_EVENT= nil -trigger.BLOCK_BRANCH_ONCE= nil -trigger.BLOCK_BRANCH_ONCE_EXCLUDED= nil -trigger.BLOCK_BUFFER_CLEAR= nil -trigger.BLOCK_CONFIG_NEXT= nil -trigger.BLOCK_CONFIG_PREV= nil -trigger.BLOCK_CONFIG_RECALL= nil -trigger.BLOCK_DELAY_CONSTANT= nil -trigger.BLOCK_DELAY_DYNAMIC= nil -trigger.BLOCK_DIGITAL_IO= nil -trigger.BLOCK_LOG_EVENT= nil -trigger.BLOCK_MEASURE_DIGITIZE= nil -trigger.BLOCK_NOP= nil -trigger.BLOCK_NOTIFY= nil -trigger.BLOCK_RESET_BRANCH_COUNT= nil -trigger.BLOCK_WAIT= nil - - ----@alias triggerBlockBranch ----| `trigger.BLOCK_BRANCH_ALWAYS` ----| `trigger.BLOCK_BRANCH_COUNTER` ----| `trigger.BLOCK_BRANCH_DELTA` ----| `trigger.BLOCK_BRANCH_LIMIT_CONSTANT` ----| `trigger.BLOCK_BRANCH_LIMIT_DYNAMIC` ----| `trigger.BLOCK_BRANCH_ON_EVENT` ----| `trigger.BLOCK_BRANCH_ONCE` ----| `trigger.BLOCK_BRANCH_ONCE_EXCLUDED` ----| `trigger.BLOCK_BUFFER_CLEAR` ----| `trigger.BLOCK_CONFIG_NEXT` ----| `trigger.BLOCK_CONFIG_PREV` ----| `trigger.BLOCK_CONFIG_RECALL` ----| `trigger.BLOCK_DELAY_CONSTANT` ----| `trigger.BLOCK_DELAY_DYNAMIC` ----| `trigger.BLOCK_DIGITAL_IO` ----| `trigger.BLOCK_LOG_EVENT` ----| `trigger.BLOCK_MEASURE_DIGITIZE` ----| `trigger.BLOCK_NOP` ----| `trigger.BLOCK_NOTIFY` ----| `trigger.BLOCK_RESET_BRANCH_COUNT` ----| `trigger.BLOCK_WAIT` diff --git a/Json_parser/StaticLuaDefinations/2461/defbuffers.lua b/Json_parser/StaticLuaDefinations/2461/defbuffers.lua deleted file mode 100644 index 502deed..0000000 --- a/Json_parser/StaticLuaDefinations/2461/defbuffers.lua +++ /dev/null @@ -1,5 +0,0 @@ ----@type bufferVar -defbuffer1 = {} - ----@type bufferVar -defbuffer2 = {} \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2461/setBlock.lua b/Json_parser/StaticLuaDefinations/2461/setBlock.lua deleted file mode 100644 index fa7718b..0000000 --- a/Json_parser/StaticLuaDefinations/2461/setBlock.lua +++ /dev/null @@ -1,6 +0,0 @@ ----This is generic function to define trigger model setblock.
----Signature of this function depends on the BlockType.
----For more details, please look at the manual by viewing hover help of blockType or opening command help ----@param blockNumber integer ----@param blockType triggerBlockBranch -function trigger.model.setblock(blockNumber, blockType,...) end \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2461/triggerBlockBranch.lua b/Json_parser/StaticLuaDefinations/2461/triggerBlockBranch.lua deleted file mode 100644 index 560b7bd..0000000 --- a/Json_parser/StaticLuaDefinations/2461/triggerBlockBranch.lua +++ /dev/null @@ -1,47 +0,0 @@ ----@meta - -trigger.BLOCK_BRANCH_ALWAYS= nil -trigger.BLOCK_BRANCH_COUNTER= nil -trigger.BLOCK_BRANCH_DELTA= nil -trigger.BLOCK_BRANCH_LIMIT_CONSTANT= nil -trigger.BLOCK_BRANCH_LIMIT_DYNAMIC= nil -trigger.BLOCK_BRANCH_ON_EVENT= nil -trigger.BLOCK_BRANCH_ONCE= nil -trigger.BLOCK_BRANCH_ONCE_EXCLUDED= nil -trigger.BLOCK_BUFFER_CLEAR= nil -trigger.BLOCK_CONFIG_NEXT= nil -trigger.BLOCK_CONFIG_PREV= nil -trigger.BLOCK_CONFIG_RECALL= nil -trigger.BLOCK_DELAY_CONSTANT= nil -trigger.BLOCK_DELAY_DYNAMIC= nil -trigger.BLOCK_DIGITAL_IO= nil -trigger.BLOCK_LOG_EVENT= nil -trigger.BLOCK_MEASURE_DIGITIZE= nil -trigger.BLOCK_NOP= nil -trigger.BLOCK_NOTIFY= nil -trigger.BLOCK_RESET_BRANCH_COUNT= nil -trigger.BLOCK_WAIT= nil - - ----@alias triggerBlockBranch ----| `trigger.BLOCK_BRANCH_ALWAYS` ----| `trigger.BLOCK_BRANCH_COUNTER` ----| `trigger.BLOCK_BRANCH_DELTA` ----| `trigger.BLOCK_BRANCH_LIMIT_CONSTANT` ----| `trigger.BLOCK_BRANCH_LIMIT_DYNAMIC` ----| `trigger.BLOCK_BRANCH_ON_EVENT` ----| `trigger.BLOCK_BRANCH_ONCE` ----| `trigger.BLOCK_BRANCH_ONCE_EXCLUDED` ----| `trigger.BLOCK_BUFFER_CLEAR` ----| `trigger.BLOCK_CONFIG_NEXT` ----| `trigger.BLOCK_CONFIG_PREV` ----| `trigger.BLOCK_CONFIG_RECALL` ----| `trigger.BLOCK_DELAY_CONSTANT` ----| `trigger.BLOCK_DELAY_DYNAMIC` ----| `trigger.BLOCK_DIGITAL_IO` ----| `trigger.BLOCK_LOG_EVENT` ----| `trigger.BLOCK_MEASURE_DIGITIZE` ----| `trigger.BLOCK_NOP` ----| `trigger.BLOCK_NOTIFY` ----| `trigger.BLOCK_RESET_BRANCH_COUNT` ----| `trigger.BLOCK_WAIT` diff --git a/Json_parser/StaticLuaDefinations/2470/defbuffers.lua b/Json_parser/StaticLuaDefinations/2470/defbuffers.lua deleted file mode 100644 index 502deed..0000000 --- a/Json_parser/StaticLuaDefinations/2470/defbuffers.lua +++ /dev/null @@ -1,5 +0,0 @@ ----@type bufferVar -defbuffer1 = {} - ----@type bufferVar -defbuffer2 = {} \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2470/setBlock.lua b/Json_parser/StaticLuaDefinations/2470/setBlock.lua deleted file mode 100644 index fa7718b..0000000 --- a/Json_parser/StaticLuaDefinations/2470/setBlock.lua +++ /dev/null @@ -1,6 +0,0 @@ ----This is generic function to define trigger model setblock.
----Signature of this function depends on the BlockType.
----For more details, please look at the manual by viewing hover help of blockType or opening command help ----@param blockNumber integer ----@param blockType triggerBlockBranch -function trigger.model.setblock(blockNumber, blockType,...) end \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2470/triggerBlockBranch.lua b/Json_parser/StaticLuaDefinations/2470/triggerBlockBranch.lua deleted file mode 100644 index 560b7bd..0000000 --- a/Json_parser/StaticLuaDefinations/2470/triggerBlockBranch.lua +++ /dev/null @@ -1,47 +0,0 @@ ----@meta - -trigger.BLOCK_BRANCH_ALWAYS= nil -trigger.BLOCK_BRANCH_COUNTER= nil -trigger.BLOCK_BRANCH_DELTA= nil -trigger.BLOCK_BRANCH_LIMIT_CONSTANT= nil -trigger.BLOCK_BRANCH_LIMIT_DYNAMIC= nil -trigger.BLOCK_BRANCH_ON_EVENT= nil -trigger.BLOCK_BRANCH_ONCE= nil -trigger.BLOCK_BRANCH_ONCE_EXCLUDED= nil -trigger.BLOCK_BUFFER_CLEAR= nil -trigger.BLOCK_CONFIG_NEXT= nil -trigger.BLOCK_CONFIG_PREV= nil -trigger.BLOCK_CONFIG_RECALL= nil -trigger.BLOCK_DELAY_CONSTANT= nil -trigger.BLOCK_DELAY_DYNAMIC= nil -trigger.BLOCK_DIGITAL_IO= nil -trigger.BLOCK_LOG_EVENT= nil -trigger.BLOCK_MEASURE_DIGITIZE= nil -trigger.BLOCK_NOP= nil -trigger.BLOCK_NOTIFY= nil -trigger.BLOCK_RESET_BRANCH_COUNT= nil -trigger.BLOCK_WAIT= nil - - ----@alias triggerBlockBranch ----| `trigger.BLOCK_BRANCH_ALWAYS` ----| `trigger.BLOCK_BRANCH_COUNTER` ----| `trigger.BLOCK_BRANCH_DELTA` ----| `trigger.BLOCK_BRANCH_LIMIT_CONSTANT` ----| `trigger.BLOCK_BRANCH_LIMIT_DYNAMIC` ----| `trigger.BLOCK_BRANCH_ON_EVENT` ----| `trigger.BLOCK_BRANCH_ONCE` ----| `trigger.BLOCK_BRANCH_ONCE_EXCLUDED` ----| `trigger.BLOCK_BUFFER_CLEAR` ----| `trigger.BLOCK_CONFIG_NEXT` ----| `trigger.BLOCK_CONFIG_PREV` ----| `trigger.BLOCK_CONFIG_RECALL` ----| `trigger.BLOCK_DELAY_CONSTANT` ----| `trigger.BLOCK_DELAY_DYNAMIC` ----| `trigger.BLOCK_DIGITAL_IO` ----| `trigger.BLOCK_LOG_EVENT` ----| `trigger.BLOCK_MEASURE_DIGITIZE` ----| `trigger.BLOCK_NOP` ----| `trigger.BLOCK_NOTIFY` ----| `trigger.BLOCK_RESET_BRANCH_COUNT` ----| `trigger.BLOCK_WAIT` diff --git a/Json_parser/Utility.cs b/Json_parser/Utility.cs index 7f3afd8..56960b2 100644 --- a/Json_parser/Utility.cs +++ b/Json_parser/Utility.cs @@ -203,10 +203,15 @@ public static string PrintFields(int depth, string file_name, Dictionary command, string file_name, string table, bool is_dircet_function = false) + public static string HelpContent(KeyValuePair command, string file_name, string table, bool is_dircet_function = false, bool is_direct_node_function = false) { var command_help = ""; @@ -243,6 +248,13 @@ public static string HelpContent(KeyValuePair command, stri NODE_STR = ""; NODE_ALIAS_STR = ""; } + + if (is_direct_node_function) // direct commands are not available with node + { + NODE_STR = "node[$node_number$]."; + NODE_ALIAS_STR = "node$node_number$_"; + } + if (cmd.command_type == CommandType.Function) { // implement function here @@ -342,6 +354,11 @@ public static string HelpContent(KeyValuePair command, stri { command_help += $"function {function_name}({cmd.signature.Substring(start, end - start)}) end\n"; } + else if (is_direct_node_function) + { + command_help += $"local function {function_name}({cmd.signature.Substring(start, end - start)}) end\n"; + command_help += $"{NODE_STR}{function_name} = { function_name}\n"; + } else { command_help += $"local function {function_name}({cmd.signature.Substring(start, end - start)}) end\n"; @@ -438,6 +455,124 @@ public static void write_to_file(string file_path, string content) File.WriteAllText(file_path, content); } + public static string get_trigger_load_cmd_signature(bool forTspLink = false) + { + if (forTspLink) + { + return @"---@param loadFunConst loadFunConstParam +local function load(loadFunConst,...) end +node[$node_number$].trigger.model.load = load"; + } + else + { + return @"---@param loadFunConst loadFunConstParam +function trigger.model.load(loadFunConst,...) end"; + } + } + + public static string get_trigger_model_setBlock_cmd_signature(bool forTspLink = false) + { + if (forTspLink) + { + return @" +---@param blockNumber integer The sequence of the block in the trigger model +---@param blockType node$node_number$_triggerBlockBranch +function setblock(blockNumber, blockType,...) end; +node[$node_number$].trigger.model.setblock = setblock +"; + } + else + { + return @" +---@param blockNumber integer The sequence of the block in the trigger model +---@param blockType triggerBlockBranch +function trigger.model.setblock(blockNumber, blockType,...) end; +"; + } + } + + public static string get_BlockType_alias(bool for_tspLink = false) + { + if (for_tspLink) + { + NODE_STR = "node[$node_number$]."; + NODE_ALIAS_STR = "node$node_number$_"; + } + else + { + NODE_STR = ""; + NODE_ALIAS_STR = ""; + } + return $@" +{NODE_STR}trigger.BLOCK_BRANCH_ALWAYS= nil +{NODE_STR}trigger.BLOCK_BRANCH_COUNTER= nil +{NODE_STR}trigger.BLOCK_BRANCH_DELTA= nil +{NODE_STR}trigger.BLOCK_BRANCH_LIMIT_CONSTANT= nil +{NODE_STR}trigger.BLOCK_BRANCH_LIMIT_DYNAMIC= nil +{NODE_STR}trigger.BLOCK_BRANCH_ON_EVENT= nil +{NODE_STR}trigger.BLOCK_BRANCH_ONCE= nil +{NODE_STR}trigger.BLOCK_BRANCH_ONCE_EXCLUDED= nil +{NODE_STR}trigger.BLOCK_BUFFER_CLEAR= nil +{NODE_STR}trigger.BLOCK_CONFIG_NEXT= nil +{NODE_STR}trigger.BLOCK_CONFIG_PREV= nil +{NODE_STR}trigger.BLOCK_CONFIG_RECALL= nil +{NODE_STR}trigger.BLOCK_DELAY_CONSTANT= nil +{NODE_STR}trigger.BLOCK_DELAY_DYNAMIC= nil +{NODE_STR}trigger.BLOCK_DIGITAL_IO= nil +{NODE_STR}trigger.BLOCK_LOG_EVENT= nil +{NODE_STR}trigger.BLOCK_MEASURE_DIGITIZE= nil +{NODE_STR}trigger.BLOCK_NOP= nil +{NODE_STR}trigger.BLOCK_NOTIFY= nil +{NODE_STR}trigger.BLOCK_RESET_BRANCH_COUNT= nil +{NODE_STR}trigger.BLOCK_WAIT= nil + + +---@alias {NODE_ALIAS_STR}triggerBlockBranch +---| `{NODE_STR}trigger.BLOCK_BRANCH_ALWAYS` +---| `{NODE_STR}trigger.BLOCK_BRANCH_COUNTER` +---| `{NODE_STR}trigger.BLOCK_BRANCH_DELTA` +---| `{NODE_STR}trigger.BLOCK_BRANCH_LIMIT_CONSTANT` +---| `{NODE_STR}trigger.BLOCK_BRANCH_LIMIT_DYNAMIC` +---| `{NODE_STR}trigger.BLOCK_BRANCH_ON_EVENT` +---| `{NODE_STR}trigger.BLOCK_BRANCH_ONCE` +---| `{NODE_STR}trigger.BLOCK_BRANCH_ONCE_EXCLUDED` +---| `{NODE_STR}trigger.BLOCK_BUFFER_CLEAR` +---| `{NODE_STR}trigger.BLOCK_CONFIG_NEXT` +---| `{NODE_STR}trigger.BLOCK_CONFIG_PREV` +---| `{NODE_STR}trigger.BLOCK_CONFIG_RECALL` +---| `{NODE_STR}trigger.BLOCK_DELAY_CONSTANT` +---| `{NODE_STR}trigger.BLOCK_DELAY_DYNAMIC` +---| `{NODE_STR}trigger.BLOCK_DIGITAL_IO` +---| `{NODE_STR}trigger.BLOCK_LOG_EVENT` +---| `{NODE_STR}trigger.BLOCK_MEASURE_DIGITIZE` +---| `{NODE_STR}trigger.BLOCK_NOP` +---| `{NODE_STR}trigger.BLOCK_NOTIFY` +---| `{NODE_STR}trigger.BLOCK_RESET_BRANCH_COUNT` +---| `{NODE_STR}trigger.BLOCK_SOURCE_OUTPUT` +---| `{NODE_STR}trigger.BLOCK_WAIT` +"; + } + + public static string get_def_buffer_definations(bool for_tspLink = false) + { + if (for_tspLink) + { + NODE_STR = "node[$node_number$]."; + NODE_ALIAS_STR = "node$node_number$_"; + } + else + { + NODE_STR = ""; + NODE_ALIAS_STR = ""; + } + return $@" +---@type bufferVar +{NODE_STR}defbuffer1 = {{}} + +---@type bufferVar +{NODE_STR}defbuffer2 = {{}} +"; + } public static void SetFileReadOnly(string file_path) { try diff --git a/helpers/HelperFunctions.py b/helpers/HelperFunctions.py index 17612a0..9a07044 100644 --- a/helpers/HelperFunctions.py +++ b/helpers/HelperFunctions.py @@ -89,13 +89,6 @@ def get_record(name, webhelpfile, cmd_type, default_value, descr, details, param supportedInstrumentsList.remove('2614B') supportedInstrumentsList.remove('2634B') """ - #rough - if "trigger.model.setblock" in name: - name = name.split("-")[1] #strip any white spaces - #signature = "NILL" - cmd_type = "Attribute (WO)\n" - #overloads = [] - #rough ends here record["name"] = name record["webhelpfile"] = webhelpfile