@@ -56,7 +56,6 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
56
56
Console . WriteLine ( cmdList . First ( ) ) ;
57
57
var outStr = "---@meta\n \n " ;
58
58
int MAX_DEPT = 10 ;
59
- var nodeTable = new HashSet < string > ( ) ;
60
59
Dictionary < string , Dictionary < string , CommandInfo > > [ ] instrTable = new Dictionary < string , Dictionary < string , CommandInfo > > [ MAX_DEPT ] ;
61
60
for ( int i = 0 ; i < MAX_DEPT ; i ++ )
62
61
{
@@ -71,35 +70,20 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
71
70
72
71
var triggerModelLoadCommands = cmdList . Where ( cmd => cmd . name . Contains ( "trigger.model.load()" ) ) . ToList ( ) ; // get trigger.model.load() commands
73
72
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 ( ) ;
76
75
77
76
78
77
cmdList = cmdList . Except ( directFunctioncommands ) . ToList ( ) ; // remove all directFunctioncommands commands and handle it speratley
79
78
80
79
cmdList = cmdList . Except ( triggerModelLoadCommands ) . ToList ( ) ; // remove all trigger.model.load() commands and handle it speratley
81
80
82
- cmdList = cmdList . Except ( bufferMathCommand ) . ToList ( ) ; // remove "buffer.math()" commands and handle it speratley
83
-
81
+
84
82
foreach ( var cmd in cmdList )
85
83
{
86
84
string s = cmd . name ;
87
85
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
+
103
87
for ( int i = 0 ; i < tSplit . Length - 1 ; i ++ )
104
88
{ //ignore functions
105
89
string attr = null ;
@@ -121,15 +105,16 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
121
105
122
106
outStr += "---@class io_object\n local io_object={}\n ---@class scriptVar\n local scriptVar={}\n ---@class eventID\n \n ---@class file_object\n local file_object ={}\n \n " ; //PRIV
123
107
outStr += "---@class bufferVar\n local bufferVar={}\n " ;
124
- outStr += "---@class digio\n digio = {}\n \n ---@class tsplink\n tsplink = {}\n \n ---@class lan\n lan = {}\n \n ---@class tspnetConnectionID\n local tspnetConnectionID = {}\n \n ---@class promptID\n local 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\n local tspnetConnectionID = {}\n \n ---@class promptID\n local promptID = {}\n \n " ;
125
109
126
110
var tsplinkStr = "" ;
127
- string [ ] arrlist = { } ;
128
111
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 ) ;
130
114
foreach ( var cmd in directFunctioncommands )
131
115
{
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 ) ;
133
118
}
134
119
135
120
if ( triggerModelLoadCommands . Count > 0 )
@@ -138,18 +123,13 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
138
123
outStr += defStr ;
139
124
tsplinkStr += defStr ;
140
125
141
- // IList<string> aliasTypes = new List<string>();
142
-
143
126
foreach ( var cmd in triggerModelLoadCommands )
144
127
{
145
- // aliasTypes.Add(cmd.name.Split('-')[1].Trim());
146
128
var header = Utility . get_command_header ( cmd , file_name ) ;
147
129
outStr += header ;
148
130
tsplinkStr += header ;
149
131
}
150
132
151
- //outStr+= Utility.create_alias_type("loadFunConstParam", aliasTypes);
152
- //tsplinkStr += Utility.create_alias_type("loadFunConstParam", aliasTypes);
153
133
var sig = "\n " + @"---@param loadFunConst loadFunConstParam
154
134
function trigger.model.load(loadFunConst,...) end" ;
155
135
outStr += sig ;
@@ -158,24 +138,7 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
158
138
159
139
}
160
140
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
+
179
142
if ( file_name . Contains ( "26" ) )
180
143
{
181
144
@@ -187,35 +150,25 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
187
150
else // for tti models
188
151
{
189
152
190
- nodeTable . Add ( "defbuffer1 = defbuffer1" ) ;
191
- nodeTable . Add ( "defbuffer2 = defbuffer2" ) ;
192
153
193
154
}
194
155
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 } \n model{ node_class_name } = { nodeTable_str } " +
198
- $ "\n --#region node details\n --#endregion";
199
-
200
156
Directory . CreateDirectory ( Path . Combine ( base_lib_dir , model ) ) ;
201
157
Directory . CreateDirectory ( Path . Combine ( base_lib_dir , model , "tspLinkSupportedCommands" ) ) ;
202
158
Directory . CreateDirectory ( Path . Combine ( base_lib_dir , model , "AllTspCommands" ) ) ;
203
159
Directory . CreateDirectory ( Path . Combine ( base_lib_dir , model , "Helper" ) ) ;
204
160
205
161
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";
209
164
210
165
var static_folder_Path = Path . Combine ( base_lib_dir , model , "Helper" ) ;
211
166
212
167
Utility . CopyStaticFiles ( model , static_folder_Path ) ;
213
168
214
- Utility . write_to_file ( nodeTableFilePath , nodeTableDetails ) ;
215
169
Utility . write_to_file ( AllTspCommandsFilePath , outStr ) ;
216
170
Utility . write_to_file ( tspLinkSupportedCommandsFilePath , tsplinkStr ) ;
217
171
218
- Utility . SetFileReadOnly ( nodeTableFilePath ) ;
219
172
Utility . SetFileReadOnly ( AllTspCommandsFilePath ) ;
220
173
Utility . SetFileReadOnly ( tspLinkSupportedCommandsFilePath ) ;
221
174
0 commit comments