Skip to content

Commit f977f37

Browse files
authored
Release/v0.18.3 (#14)
1 parent 3d66961 commit f977f37

File tree

131 files changed

+1578
-3653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1578
-3653
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1515
Fixed -- for any bug fixes.
1616
Security -- in case of vulnerabilities.
1717
-->
18+
## [0.18.3]
19+
20+
### Added
21+
- support dynamically creating enums for configured nodes
1822

1923
## [0.18.2]
2024

@@ -49,7 +53,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
4953
- workflow has been added for generaing json artifacts.
5054

5155
<!--Version Comparison Links-->
52-
[Unreleased]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/compare/v0.18.2...HEAD
56+
[Unreleased]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/compare/v0.18.3...HEAD
57+
[0.18.3]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.18.3
5358
[0.18.2]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.18.2
5459
[0.18.1]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.18.1
5560
[0.18.0]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.18.0

Configuration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Folder path of webhelp file
22
import os
33

4-
class Confiurations:
4+
class Configuration:
55
HELP_FILE_FOLDER_PATH = ""
66

7+
MANUALLY_EXTRACTED_COMMANDS = {}
8+
PARAMS_TYPES_DETAILS = {}
9+
710
# model number
811
MODEL_NUMBER = ""
912

Json_parser/Program.cs

Lines changed: 12 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
5656
Console.WriteLine(cmdList.First());
5757
var outStr = "---@meta\n\n";
5858
int MAX_DEPT = 10;
59-
var nodeTable = new HashSet<string>();
6059
Dictionary<string, Dictionary<string, CommandInfo>>[] instrTable = new Dictionary<string, Dictionary<string, CommandInfo>>[MAX_DEPT];
6160
for (int i = 0; i < MAX_DEPT; i++)
6261
{
@@ -71,35 +70,20 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
7170

7271
var triggerModelLoadCommands = cmdList.Where(cmd => cmd.name.Contains("trigger.model.load()")).ToList(); // get trigger.model.load() commands
7372

74-
var bufferMathCommand = cmdList.Where(cmd => cmd.name.Contains("buffer.math()")).ToList();
75-
73+
var triggerBlockConstants = cmdList.Where(cmd => cmd.name.Contains("trigger.BLOCK_")).ToList();
74+
cmdList = cmdList.Except(triggerBlockConstants).ToList();
7675

7776

7877
cmdList = cmdList.Except(directFunctioncommands).ToList(); // remove all directFunctioncommands commands and handle it speratley
7978

8079
cmdList = cmdList.Except(triggerModelLoadCommands).ToList(); // remove all trigger.model.load() commands and handle it speratley
8180

82-
cmdList = cmdList.Except(bufferMathCommand).ToList(); // remove "buffer.math()" commands and handle it speratley
83-
81+
8482
foreach (var cmd in cmdList)
8583
{
8684
string s = cmd.name;
8785
var tSplit = s.Contains(".") ? s.Trim().Split('.') : s.Trim().Split(':');
88-
if (cmd.tsplink_supported.Contains("Yes"))
89-
{
90-
//if (tSplit[0] == "bufferVar")
91-
//continue;
92-
if (tSplit.Length > 1)
93-
{
94-
nodeTable.Add(tSplit[0] + " = " + tSplit[0]);
95-
}
96-
else
97-
{
98-
nodeTable.Add(s.Contains('(') ? s.Split('(')[0] + " = " + s.Split('(')[0] : s + " = " + s);
99-
}
100-
}
101-
102-
86+
10387
for (int i = 0; i < tSplit.Length - 1; i++)
10488
{//ignore functions
10589
string attr = null;
@@ -121,15 +105,16 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
121105

122106
outStr += "---@class io_object\nlocal io_object={}\n---@class scriptVar\nlocal scriptVar={}\n---@class eventID\n\n---@class file_object\nlocal file_object ={}\n\n"; //PRIV
123107
outStr += "---@class bufferVar\nlocal bufferVar={}\n";
124-
outStr += "---@class digio\n digio = {}\n\n---@class tsplink\n tsplink = {}\n\n---@class lan\n lan = {}\n\n---@class tspnetConnectionID\nlocal tspnetConnectionID = {}\n\n ---@class promptID\nlocal promptID = {}\n\n";
108+
outStr += "---@class digio\n local digio = {}\n\n---@class tsplink\n local tsplink = {}\n\n---@class lan\n local lan = {}\n\n---@class tspnetConnectionID\nlocal tspnetConnectionID = {}\n\n ---@class promptID\nlocal promptID = {}\n\n";
125109

126110
var tsplinkStr = "";
127-
string[] arrlist = { };
128111
tsplinkStr = outStr;
129-
Utility.PrintFields(MAX_DEPT, file_name, ref instrTable, ref outStr, ref tsplinkStr, ref arrlist, "null");
112+
tsplinkStr += Utility.PrintFields(MAX_DEPT, file_name, instrTable, true);
113+
outStr += Utility.PrintFields(MAX_DEPT, file_name, instrTable, false);
130114
foreach (var cmd in directFunctioncommands)
131115
{
132-
Utility.HelpContent(cmd, file_name, ref outStr, ref tsplinkStr, "", true, "", "", true);
116+
var cmd_info = new KeyValuePair<string, CommandInfo>(cmd.name, cmd);
117+
outStr += Utility.HelpContent(cmd_info, file_name, "", true);
133118
}
134119

135120
if (triggerModelLoadCommands.Count > 0)
@@ -138,18 +123,13 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
138123
outStr += defStr;
139124
tsplinkStr += defStr;
140125

141-
// IList<string> aliasTypes = new List<string>();
142-
143126
foreach (var cmd in triggerModelLoadCommands)
144127
{
145-
// aliasTypes.Add(cmd.name.Split('-')[1].Trim());
146128
var header = Utility.get_command_header(cmd, file_name);
147129
outStr += header;
148130
tsplinkStr += header;
149131
}
150132

151-
//outStr+= Utility.create_alias_type("loadFunConstParam", aliasTypes);
152-
//tsplinkStr += Utility.create_alias_type("loadFunConstParam", aliasTypes);
153133
var sig = "\n" + @"---@param loadFunConst loadFunConstParam
154134
function trigger.model.load(loadFunConst,...) end";
155135
outStr += sig;
@@ -158,24 +138,7 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
158138

159139
}
160140

161-
if (bufferMathCommand.Count > 0)
162-
{
163-
var alias = Utility.create_enum_alias_type(bufferMathCommand[0].param_info[1]);
164-
var header = Utility.get_command_header(bufferMathCommand[0], file_name);
165-
166-
outStr += alias + header;
167-
tsplinkStr += alias + header;
168-
169-
Utility.append_buffermath_signature(ref outStr);
170-
Utility.append_buffermath_signature(ref tsplinkStr);
171-
172-
}
173-
174-
nodeTable.Remove("node[N] = node[N]"); // for now removing this command from nodeTable because its creating problem in lua definitions
175-
nodeTable.Remove("slot[slot] = slot[slot]"); // for now removing this command from nodeTable because its creating problem in lua definition
176-
177-
178-
141+
179142
if (file_name.Contains("26"))
180143
{
181144

@@ -187,35 +150,25 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
187150
else // for tti models
188151
{
189152

190-
nodeTable.Add("defbuffer1 = defbuffer1");
191-
nodeTable.Add("defbuffer2 = defbuffer2");
192153

193154
}
194155

195-
var nodeTable_str = @"{" + string.Join(",\n ", nodeTable) + "\n}";
196-
var node_class_name = Regex.Replace(file_name, @"[^a-zA-Z0-9_]", "");
197-
var nodeTableDetails = $"---@meta\n\n---@class model{node_class_name}\nmodel{node_class_name} = {nodeTable_str}" +
198-
$"\n--#region node details\n--#endregion";
199-
200156
Directory.CreateDirectory(Path.Combine(base_lib_dir, model));
201157
Directory.CreateDirectory(Path.Combine(base_lib_dir, model, "tspLinkSupportedCommands"));
202158
Directory.CreateDirectory(Path.Combine(base_lib_dir, model, "AllTspCommands"));
203159
Directory.CreateDirectory(Path.Combine(base_lib_dir, model, "Helper"));
204160

205161

206-
var nodeTableFilePath = $"{base_lib_dir}/{model}/tspLinkSupportedCommands/nodeTable.lua";
207-
var AllTspCommandsFilePath = $"{base_lib_dir}/{model}/AllTspCommands/" + file_name + ".lua";
208-
var tspLinkSupportedCommandsFilePath = $"{base_lib_dir}/{model}/tspLinkSupportedCommands/" + file_name + "_TSPLink.lua";
162+
var AllTspCommandsFilePath = $"{base_lib_dir}/{model}/AllTspCommands/definitions.lua";
163+
var tspLinkSupportedCommandsFilePath = $"{base_lib_dir}/{model}/tspLinkSupportedCommands/definitions.txt";
209164

210165
var static_folder_Path = Path.Combine(base_lib_dir, model, "Helper");
211166

212167
Utility.CopyStaticFiles(model, static_folder_Path);
213168

214-
Utility.write_to_file(nodeTableFilePath, nodeTableDetails);
215169
Utility.write_to_file(AllTspCommandsFilePath, outStr);
216170
Utility.write_to_file(tspLinkSupportedCommandsFilePath, tsplinkStr);
217171

218-
Utility.SetFileReadOnly(nodeTableFilePath);
219172
Utility.SetFileReadOnly(AllTspCommandsFilePath);
220173
Utility.SetFileReadOnly(tspLinkSupportedCommandsFilePath);
221174

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"jsonToLuaParser": {
4+
"commandName": "Project",
5+
"commandLineArgs": "C:\\Users\\rjha\\source\\repos\\GitHub\\tsp-toolkit-webhelp-to-json\\data"
6+
}
7+
}
8+
}

Json_parser/StaticLuaDefinations/2450/bufferCustomUnit.lua

Lines changed: 0 additions & 10 deletions
This file was deleted.

Json_parser/StaticLuaDefinations/2450/bufferFileSaveDetails.lua

Lines changed: 0 additions & 61 deletions
This file was deleted.

Json_parser/StaticLuaDefinations/2450/bufferVarstatuses.lua

Lines changed: 0 additions & 21 deletions
This file was deleted.

Json_parser/StaticLuaDefinations/2450/buttonPressAlias.lua

Lines changed: 0 additions & 13 deletions
This file was deleted.

Json_parser/StaticLuaDefinations/2450/channelMatchType.lua

Lines changed: 0 additions & 16 deletions
This file was deleted.

Json_parser/StaticLuaDefinations/2450/displayText.lua

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)