Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
11 andreas 1
/*
101 andreas 2
 * Copyright (C) 2020 to 2022 by Andreas Theofilu <andreas@theosys.at>
11 andreas 3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#include "tamxcommands.h"
209 andreas 20
#include "tpagemanager.h"
11 andreas 21
#include "terror.h"
22
#include "tresources.h"
14 andreas 23
#include "tconfig.h"
78 andreas 24
#include "texpat++.h"
11 andreas 25
 
83 andreas 26
#include <string>
27
#include <vector>
28
 
186 andreas 29
#if __cplusplus < 201402L
30
#   error "This module requires at least C++14 standard!"
31
#else
32
#   if __cplusplus < 201703L
33
#       include <experimental/filesystem>
34
namespace fs = std::experimental::filesystem;
35
#       warning "Support for C++14 and experimental filesystem will be removed in a future version!"
36
#   else
37
#       include <filesystem>
38
#       ifdef __ANDROID__
39
namespace fs = std::__fs::filesystem;
40
#       else
41
namespace fs = std::filesystem;
42
#       endif
43
#   endif
44
#endif
45
 
11 andreas 46
using std::string;
47
using std::vector;
78 andreas 48
using namespace Expat;
11 andreas 49
 
50
typedef struct CMD_DEFINATIONS
51
{
52
    string cmd;
53
    bool hasChannels{false};
54
    bool hasPars{false};
14 andreas 55
    char separator{0};
11 andreas 56
}CMD_DEFINATIONS;
57
 
58
CMD_DEFINATIONS cmdDefinations[] = {
14 andreas 59
    { "@WLD", false, true, ',' },
60
    { "@AFP", false, true, ',' },
127 andreas 61
    { "^AFP", false, true, ',' },
14 andreas 62
    { "@GCE", false, true, ',' },
127 andreas 63
    { "^GCE", false, true, ',' },
14 andreas 64
    { "@APG", false, true, ';' },
65
    { "@CPG", false, true, ',' },
66
    { "@DPG", false, true, ';' },
67
    { "@PDR", false, true, ';' },
68
    { "@PHE", false, true, ';' },
69
    { "@PHP", false, true, ';' },
70
    { "@PHT", false, true, ';' },
71
    { "@PPA", false, true, ',' },
104 andreas 72
    { "^PPA", false, true, ',' },
14 andreas 73
    { "@PPF", false, true, ';' },
104 andreas 74
    { "^PPF", false, true, ';' },
14 andreas 75
    { "@PPG", false, true, ';' },
104 andreas 76
    { "^PPG", false, true, ';' },
14 andreas 77
    { "@PPK", false, true, ',' },
104 andreas 78
    { "^PPK", false, true, ',' },
14 andreas 79
    { "@PPM", false, true, ';' },
104 andreas 80
    { "^PPM", false, true, ';' },
14 andreas 81
    { "@PPN", false, true, ';' },
104 andreas 82
    { "^PPN", false, true, ';' },
14 andreas 83
    { "@PPT", false, true, ';' },
104 andreas 84
    { "^PPT", false, true, ';' },
14 andreas 85
    { "@PPX", false, false, '\0' },
104 andreas 86
    { "^PPX", false, false, '\0' },
14 andreas 87
    { "@PSE", false, true, ';' },
88
    { "@PSP", false, true, ';' },
89
    { "@PST", false, true, ';' },
90
    { "PAGE", false, true, ',' },
104 andreas 91
    { "^PGE", false, true, ',' },
14 andreas 92
    { "PPOF", false, true, ';' },
93
    { "PPOG", false, true, ';' },
94
    { "PPON", false, true, ';' },
95
    { "^ANI", true, true, ',' },
96
    { "^APF", true, true, ',' },
97
    { "^BAT", true, true, ',' },
98
    { "^BAU", true, true, ',' },
99
    { "^BCB", true, true, ',' },
100
    { "?BCB", true, true, ',' },
101
    { "^BCF", true, true, ',' },
102
    { "?BCF", true, true, ',' },
103
    { "^BCT", true, true, ',' },
104
    { "?BCT", true, true, ',' },
105
    { "^BDO", true, true, ',' },
106
    { "^BFB", true, true, ',' },
107
    { "^BIM", true, true, ',' },
108
    { "^BLN", true, true, ',' },
109
    { "^BMC", true, true, ',' },
110
    { "^BMF", true, true, ',' },
111
    { "^BMI", true, true, ',' },
112
    { "^BML", true, true, ',' },
113
    { "^BMP", true, true, ',' },
114
    { "?BMP", true, true, ',' },
115
    { "^BNC", true, true, ',' },
116
    { "^BNN", true, true, ',' },
117
    { "^BNT", true, true, ',' },
118
    { "^BOP", true, true, ',' },
119
    { "?BOP", true, true, ',' },
120
    { "^BOR", true, true, ',' },
121
    { "^BOS", true, true, ',' },
122
    { "^BPP", true, true, ',' },
123
    { "^BRD", true, true, ',' },
124
    { "?BRD", true, true, ',' },
125
    { "^BSF", true, true, ',' },
126
    { "^BSP", true, true, ',' },
127
    { "^BSM", true, false, ',' },
128
    { "^BSO", true, true, ',' },
129
    { "^BVL", true, true, ',' },
130
    { "^BVN", false, true, ',' },
131
    { "^BVP", true, true, ',' },
132
    { "^BVT", true, true, ',' },
133
    { "^BWW", true, true, ',' },
134
    { "?BWW", true, true, ',' },
135
    { "^CPF", true, false, ',' },
136
    { "^DLD", false, false, ',' },
137
    { "^DPF", true, true, ',' },
138
    { "^ENA", true, true, ',' },
139
    { "^FON", true, true, ',' },
140
    { "?FON", true, true, ',' },
141
    { "^GDI", true, true, ',' },
142
    { "^GIV", true, true, ',' },
143
    { "^GLH", true, true, ',' },
144
    { "^GLL", true, true, ',' },
145
    { "^GRD", true, true, ',' },
146
    { "^GRU", true, true, ',' },
147
    { "^GSC", true, true, ',' },
148
    { "^GSN", true, true, ',' },
149
    { "^ICO", true, true, ',' },
150
    { "?ICO", true, true, ',' },
151
    { "^IRM", false, true, ',' },
152
    { "^JSB", true, true, ',' },
153
    { "?JSB", true, true, ',' },
154
    { "^JSI", true, true, ',' },
155
    { "?JSI", true, true, ',' },
156
    { "^JST", true, true, ',' },
157
    { "?JST", true, true, ',' },
158
    { "^MBT", false, false, ',' },
159
    { "^MDC", false, false, ',' },
160
    { "^SHO", true, true, ',' },
161
    { "^TEC", true, true, ',' },
162
    { "?TEC", true, true, ',' },
163
    { "^TEF", true, true, ',' },
164
    { "?TEF", true, true, ',' },
165
    { "^TOP", false, true, ',' },
166
    { "^TXT", true, true, ',' },
167
    { "?TXT", true, true, ',' },
168
    { "^UNI", true, true, ',' },
104 andreas 169
    { "^UTF", true, true, ',' },
14 andreas 170
    { "^LPC", false, true, ',' },
171
    { "^LPR", false, true, ',' },
172
    { "^LPS", false, true, ',' },
173
    { "ABEEP", false, false, ',' },
174
    { "ADBEEP", false, false, ',' },
175
    { "@AKB", false, true, ';' },
176
    { "AKEYB", false, true, ',' },
177
    { "AKEYP", false, true, ',' },
178
    { "AKEYR", false, true, ',' },
179
    { "@AKP", false, true, ';' },
180
    { "@AKR", false, false, ',' },
181
    { "BEEP", false, false, ',' },
104 andreas 182
    { "^ABP", false, false, ',' },
14 andreas 183
    { "BRIT", false, true, ',' },
184
    { "@BRT", false, true, ',' },
185
    { "DBEEP", false, false, ',' },
104 andreas 186
    { "^ADP", false, false, ',' },
14 andreas 187
    { "@EKP", false, true, ';' },
188
    { "PKEYP", false, true, ',' },
63 andreas 189
    { "@PKB", false, true, ';' },
104 andreas 190
    { "^PKB", false, true, ';' },
14 andreas 191
    { "@PKP", false, true, ';' },
104 andreas 192
    { "^PKP", false, true, ';' },
14 andreas 193
    { "SETUP", false, false, ',' },
104 andreas 194
    { "^STP", false, false, ',' },
14 andreas 195
    { "SHUTDOWN", false, false, ',' },
196
    { "SLEEP", false, false, ',' },
197
    { "@SOU", false, true, ',' },
104 andreas 198
    { "^SOU", false, true, ',' },
14 andreas 199
    { "@TKP", false, true, ';' },
104 andreas 200
    { "^TKP", false, true, ';' },
14 andreas 201
    { "TPAGEON", false, false, ',' },
202
    { "TPAGEOFF", false, false, ',' },
203
    { "@VKB", false, false, ',' },
104 andreas 204
    { "^VKB", false, false, ',' },
14 andreas 205
    { "WAKE", false, false, ',' },
206
    { "^CAL", false, false, ',' },
207
    { "^KPS", false, true, ',' },
208
    { "^VKS", false, true, ',' },
127 andreas 209
    { "^WCN?", false, true, ',' },
14 andreas 210
    { "@PWD", false, true, ',' },
211
    { "^PWD", false, true, ',' },
212
    { "^BBR", true, true, ',' },
213
    { "^RAF", false, true, ',' },
214
    { "^RFR", false, true, ',' },
215
    { "^RMF", false, true, ',' },
216
    { "^RSR", false, true, ',' },
217
    { "^MODEL?", false, false, ',' },
127 andreas 218
    { "^MOD", false, false, ',' },
219
    { "^VER?", false, false, ',' },
14 andreas 220
    { "^ICS", false, true, ',' },
221
    { "^ICE", false, false, ',' },
222
    { "^ICM", false, true, ',' },
223
    { "^PHN", false, true, ',' },
224
    { "?PHN", false, true, ',' },
233 andreas 225
    { "^LVC", false, true, ',' },
227 andreas 226
    { "^LVD", true, true, ',' },
227
    { "^LVE", true, true, ',' },
228
    { "^LVF", true, true, ',' },
233 andreas 229
    { "^LVL", true, true, ',' },
230
    { "^LVM", true, true, '|' },
231
    { "^LVN", true, true, ',' },
232
    { "^LVR", true, true, ',' },
233
    { "^LVS", true, true, ',' },
127 andreas 234
    { "GET ", false, false, ',' },
235
    { "SET ", false, false, ',' },
14 andreas 236
    { "LEVON", false, false, ',' },
237
    { "RXON", false, false, ',' },
238
    { "ON", false, true, ',' },
239
    { "OFF", false, true, ',' },
15 andreas 240
    { "LEVEL", false, true, ',' },
241
    { "BLINK", false, true, ',' },
23 andreas 242
    { "#FTR", false, true, ':' },
134 andreas 243
    { "TPCCMD", false, true, ',' },
244
    { "TPCACC", false, true, ',' },
153 andreas 245
    { "TPCSIP", false, true, ',' },
14 andreas 246
    { "", false, false, '\0' }
11 andreas 247
};
248
 
249
CMD_DEFINATIONS& findCmdDefines(const string& cmd)
250
{
251
    DECL_TRACER("findCmdDefines(const string& cmd)");
252
 
253
    int i = 0;
101 andreas 254
    string uCmd = cmd;
255
    uCmd = toUpper(uCmd);
11 andreas 256
 
257
    while (cmdDefinations[i].cmd.length() > 0)
258
    {
101 andreas 259
        if (cmdDefinations[i].cmd.compare(uCmd) == 0)
11 andreas 260
            return cmdDefinations[i];
261
 
262
        i++;
263
    }
264
 
265
    return cmdDefinations[i];
266
}
267
 
268
TAmxCommands::TAmxCommands()
269
{
270
    DECL_TRACER("TAmxCommands::TAmxCommands()");
271
}
272
 
273
TAmxCommands::~TAmxCommands()
274
{
275
    DECL_TRACER("TAmxCommands::~TAmxCommands()");
194 andreas 276
 
277
    if (mMap && mSystemMap && mMap != mSystemMap)
278
    {
279
        delete mMap;
280
        delete mSystemMap;
281
    }
282
    else if (mMap)
283
        delete mMap;
284
    else if (mSystemMap)
285
        delete mSystemMap;
11 andreas 286
}
287
 
14 andreas 288
bool TAmxCommands::readMap()
289
{
290
    DECL_TRACER("TAmxCommands::readMap()");
291
 
193 andreas 292
    bool err = false;
186 andreas 293
    string projectPath = TConfig::getProjectPath();
294
 
193 andreas 295
    if (fs::exists(projectPath + "/prj.xma"))
88 andreas 296
    {
194 andreas 297
        mMap = new TMap(projectPath);
193 andreas 298
        err = mMap->haveError();
88 andreas 299
    }
14 andreas 300
 
193 andreas 301
    projectPath += "/__system";
14 andreas 302
 
193 andreas 303
    if (fs::exists(projectPath + "/prj.xma"))
14 andreas 304
    {
194 andreas 305
        mSystemMap = new TMap(projectPath);
14 andreas 306
 
193 andreas 307
        if (!err)
194 andreas 308
            err = mSystemMap->haveError();
14 andreas 309
    }
310
 
194 andreas 311
    if (!mMap)
312
        mMap = mSystemMap;
313
 
193 andreas 314
    return !err;
14 andreas 315
}
316
 
317
vector<string> TAmxCommands::getFields(string& msg, char sep)
318
{
319
    DECL_TRACER("TAmxCommands::getFields(string& msg, char sep)");
320
 
321
    vector<string> flds;
322
    bool bStr = false;
323
    string part;
324
 
16 andreas 325
    for (size_t i = 0; i < msg.length(); i++)
14 andreas 326
    {
16 andreas 327
        if (msg.at(i) == sep && !bStr)
14 andreas 328
        {
329
            flds.push_back(part);
330
            part.clear();
331
            continue;
332
        }
16 andreas 333
        else if (msg.at(i) == '\'' && !bStr)
14 andreas 334
            bStr = true;
16 andreas 335
        else if (msg.at(i) == '\'' && bStr)
14 andreas 336
            bStr = false;
337
        else
16 andreas 338
            part.append(msg.substr(i, 1));
14 andreas 339
    }
340
 
341
    if (!part.empty())
342
        flds.push_back(part);
343
 
83 andreas 344
    if (flds.size() > 0 && TStreamError::checkFilter(HLOG_DEBUG))
14 andreas 345
    {
346
        MSG_DEBUG("Found fields:");
347
        vector<string>::iterator iter;
348
        int i = 1;
349
 
118 andreas 350
        for (iter = flds.begin(); iter != flds.end(); ++iter)
14 andreas 351
        {
352
            MSG_DEBUG("    " << i << ": " << *iter);
353
            i++;
354
        }
355
    }
356
 
357
    return flds;
358
}
359
 
193 andreas 360
vector<TMap::MAP_T> TAmxCommands::findButtons(int port, vector<int>& channels, TMap::MAP_TYPE mt)
14 andreas 361
{
193 andreas 362
    DECL_TRACER("TAmxCommands::findButtons(int port, vector<int>& channels, TMap::MAP_TYPE mt)");
14 andreas 363
 
193 andreas 364
    vector<TMap::MAP_T> map;
14 andreas 365
 
209 andreas 366
    if (gPageManager && gPageManager->isSetupActive())
367
        map = mSystemMap->findButtons(port, channels, mt);
368
    else
369
        map = mMap->findButtons(port, channels, mt);
19 andreas 370
 
14 andreas 371
    return map;
372
}
373
 
165 andreas 374
string TAmxCommands::findImage(int bt, int page, int instance)
375
{
376
    DECL_TRACER("TAmxCommands::findImage(int bt, int page, int instance)");
377
 
209 andreas 378
    if (page < SYSTEM_PAGE_START)
193 andreas 379
        return mMap->findImage(bt, page, instance);
165 andreas 380
 
193 andreas 381
    return mSystemMap->findImage(bt, page, instance);
165 andreas 382
}
383
 
384
string TAmxCommands::findImage(const string& name)
385
{
386
    DECL_TRACER("TAmxCommands::findImage(const string& name)");
387
 
193 andreas 388
    string str = mMap->findImage(name);
165 andreas 389
 
193 andreas 390
    if (str.empty())
391
        return mSystemMap->findImage(name);
165 andreas 392
 
193 andreas 393
    return str;
165 andreas 394
}
395
 
193 andreas 396
vector<TMap::MAP_T> TAmxCommands::findButtonByName(const string& name)
97 andreas 397
{
398
    DECL_TRACER("TAmxCommands::findButtonByName(const string& name)");
399
 
193 andreas 400
    vector<TMap::MAP_T> map = mMap->findButtonByName(name);
97 andreas 401
 
193 andreas 402
    if (map.empty())
403
        return mSystemMap->findButtonByName(name);
97 andreas 404
 
405
    return map;
406
}
407
 
193 andreas 408
vector<TMap::MAP_T> TAmxCommands::findBargraphs(int port, vector<int>& channels)
15 andreas 409
{
410
    DECL_TRACER("TAmxCommands::findBargraphs(int port, vector<int>& channels)");
411
 
193 andreas 412
    vector<TMap::MAP_T> map = mMap->findBargraphs(port, channels);
15 andreas 413
 
193 andreas 414
    if (map.empty())
415
        return mSystemMap->findBargraphs(port, channels);
83 andreas 416
 
15 andreas 417
    return map;
418
}
419
 
107 andreas 420
vector<string> TAmxCommands::findSounds()
421
{
422
    DECL_TRACER("TAmxCommands::findSounds()");
423
 
193 andreas 424
    return mMap->findSounds();      // This is enough because there are no sounds in the system settings
107 andreas 425
}
426
 
118 andreas 427
bool TAmxCommands::soundExist(const string& sname)
107 andreas 428
{
429
    DECL_TRACER("TAmxCommands::soundExist(const string sname)");
430
 
193 andreas 431
    return mMap->soundExist(sname);
107 andreas 432
}
433
 
11 andreas 434
bool TAmxCommands::parseCommand(int device, int port, const string& cmd)
435
{
436
    DECL_TRACER("TAmxCommands::parseCommand(int device, int port, const string& cmd)");
169 andreas 437
 
11 andreas 438
    vector<CMD_TABLE>::iterator iter;
16 andreas 439
    size_t pos = cmd.find_first_of("-");
127 andreas 440
    int system = TConfig::getSystem();
441
    string scmd = getCommand(cmd);
11 andreas 442
 
127 andreas 443
    MSG_TRACE("Parsing for device <" << device << ":" << port << ":" << system << "> the command: " << scmd);
13 andreas 444
 
11 andreas 445
    if (pos != string::npos)    // Command with parameters
446
    {
447
        string rest = cmd.substr(pos + 1);
448
 
118 andreas 449
        for (iter = mCmdTable.begin(); iter != mCmdTable.end(); ++iter)
11 andreas 450
        {
13 andreas 451
            iter->channels.clear();
452
            iter->pars.clear();
453
 
153 andreas 454
            if (iter->cmd.compare(scmd) == 0 && iter->command)
11 andreas 455
            {
153 andreas 456
                CMD_DEFINATIONS cdef = findCmdDefines(scmd);
11 andreas 457
 
458
                if (cdef.cmd.empty())
459
                {
153 andreas 460
                    MSG_WARNING("Command \"" << scmd << "\" not found in command table! Ignoring it.");
11 andreas 461
                    continue;
462
                }
463
 
464
                if (cdef.hasChannels || cdef.hasPars)
465
                {
14 andreas 466
                    vector<string> parts = getFields(rest, cdef.separator);
11 andreas 467
 
468
                    if (cdef.hasChannels)
13 andreas 469
                        extractChannels(parts[0], &iter->channels);
11 andreas 470
 
471
                    if (cdef.hasPars)
472
                    {
13 andreas 473
                        MSG_DEBUG("Command may have parameters. Found " << parts.size() << " parameters.");
11 andreas 474
 
13 andreas 475
                        if (parts.size() > 0)
11 andreas 476
                        {
13 andreas 477
                            vector<string>::iterator piter;
478
                            int cnt = 0;
479
 
118 andreas 480
                            for (piter = parts.begin(); piter != parts.end(); ++piter)
11 andreas 481
                            {
13 andreas 482
                                if (cdef.hasChannels && !cnt)
483
                                {
484
                                    cnt++;
485
                                    continue;
486
                                }
487
 
488
                                iter->pars.push_back(*piter);
11 andreas 489
                                cnt++;
490
                            }
491
                        }
13 andreas 492
                        else
493
                            iter->pars.push_back(rest);
11 andreas 494
                    }
495
                }
496
 
497
                iter->command(port, iter->channels, iter->pars);
498
                return true;
499
            }
500
        }
501
    }
502
    else        // Command without parameter
503
    {
118 andreas 504
        for (iter = mCmdTable.begin(); iter != mCmdTable.end(); ++iter)
11 andreas 505
        {
153 andreas 506
            if (iter->cmd.compare(scmd) == 0 && iter->command)
11 andreas 507
            {
508
                iter->command(port, iter->channels, iter->pars);
509
                return true;
510
            }
511
        }
512
    }
513
 
514
    MSG_WARNING("Command \"" << cmd << "\" currently not supported!");
515
    return false;
516
}
517
 
518
bool TAmxCommands::extractChannels(const string& schan, vector<int>* ch)
519
{
520
    DECL_TRACER("TAmxCommands::extractChannels(const string& schan, vector<int>* ch)");
521
 
522
    if (!ch || schan.empty())
523
        return false;
524
 
16 andreas 525
    if (schan.find("&") == string::npos && schan.find(".") == string::npos)
11 andreas 526
    {
527
        int c = atoi(schan.c_str());
528
        ch->push_back(c);
529
        return true;
530
    }
531
 
532
    if (schan.find("&") != string::npos)
533
    {
534
        vector<string> parts = StrSplit(schan, "&");
535
        vector<string>::iterator iter;
536
 
83 andreas 537
        if (parts.size() > 0)
11 andreas 538
        {
118 andreas 539
            for (iter = parts.begin(); iter != parts.end(); ++iter)
11 andreas 540
            {
83 andreas 541
                if (iter->find(".") != string::npos)
542
                {
543
                    vector<string> p2 = StrSplit(*iter, ".");
11 andreas 544
 
83 andreas 545
                    if (p2.size() >= 2)
546
                    {
547
                        for (int i = atoi(p2[0].c_str()); i <= atoi(p2[1].c_str()); i++)
548
                            ch->push_back(i);
549
                    }
550
                    else if (p2.size() > 0)
551
                        ch->push_back(atoi(p2[0].c_str()));
38 andreas 552
                }
83 andreas 553
                else
554
                    ch->push_back(atoi(iter->c_str()));
11 andreas 555
            }
556
        }
557
    }
558
    else
559
    {
560
        vector<string> parts = StrSplit(schan, ".");
561
 
38 andreas 562
        if (parts.size() >= 2)
563
        {
60 andreas 564
            for (int i = atoi(parts[0].c_str()); i <= atoi(parts[1].c_str()); i++)
38 andreas 565
                ch->push_back(i);
566
        }
567
        else if (parts.size() > 0)
568
            ch->push_back(atoi(parts[0].c_str()));
11 andreas 569
    }
570
 
571
    return true;
572
}
573
 
574
void TAmxCommands::registerCommand(std::function<void (int port, vector<int>& channels, vector<string>& pars)> command, const string& name)
575
{
576
    DECL_TRACER("TAmxCommands::registerCommand(std::function<void (vector<int>& channels, vector<string>& pars)> command, const string& name)");
577
 
578
    vector<CMD_TABLE>::iterator iter;
579
 
118 andreas 580
    for (iter = mCmdTable.begin(); iter != mCmdTable.end(); ++iter)
11 andreas 581
    {
582
        if (iter->cmd.compare(name) == 0)
583
        {
584
            iter->command = command;
585
            iter->channels.clear();
586
            iter->pars.clear();
587
            return;
588
        }
589
    }
590
 
591
    CMD_TABLE ctbl;
592
    ctbl.cmd = name;
593
    ctbl.command = command;
594
    mCmdTable.push_back(ctbl);
595
}