10 |
# Then src/network/lscp_shell_reference.cpp is generated by this script with |
# Then src/network/lscp_shell_reference.cpp is generated by this script with |
11 |
# the documentation for each individual LSCP command extracted. |
# the documentation for each individual LSCP command extracted. |
12 |
# |
# |
13 |
# Usage: generate_lscp_shell_reference.pl |
# Usage: generate_lscp_shell_reference.pl [--output=OUTFILE] [--debug-xml-extract] |
14 |
|
|
15 |
use XML::Parser; |
use XML::Parser; |
16 |
use Data::Dumper; # just for debugging |
use Data::Dumper; # just for debugging |
278 |
* * |
* * |
279 |
* LSCP documentation reference built into LSCP shell. * |
* LSCP documentation reference built into LSCP shell. * |
280 |
* * |
* * |
281 |
* Copyright (c) 2014 Christian Schoenebeck * |
* Copyright (c) 2014 - 2016 Christian Schoenebeck * |
282 |
* * |
* * |
283 |
* This program is part of LinuxSampler and released under the same terms. * |
* This program is part of LinuxSampler and released under the same terms. * |
284 |
* * |
* * |
320 |
}; |
}; |
321 |
|
|
322 |
lscp_ref_entry_t* lscp_reference_for_command(const char* cmd) { |
lscp_ref_entry_t* lscp_reference_for_command(const char* cmd) { |
323 |
const int n1 = strlen(cmd); |
const int n1 = (int)strlen(cmd); |
324 |
if (!n1) return NULL; |
if (!n1) return NULL; |
325 |
int foundLength = 0; |
int foundLength = 0; |
326 |
lscp_ref_entry_t* foundEntry = NULL; |
lscp_ref_entry_t* foundEntry = NULL; |
327 |
for (int i = 0; i < sizeof(lscp_reference) / sizeof(lscp_ref_entry_t); ++i) { |
for (int i = 0; i < sizeof(lscp_reference) / sizeof(lscp_ref_entry_t); ++i) { |
328 |
const int n2 = strlen(lscp_reference[i].name); |
const int n2 = (int)strlen(lscp_reference[i].name); |
329 |
const int n = n1 < n2 ? n1 : n2; |
const int n = n1 < n2 ? n1 : n2; |
330 |
if (!strncmp(cmd, lscp_reference[i].name, n)) { |
if (!strncmp(cmd, lscp_reference[i].name, n)) { |
331 |
if (foundEntry) { |
if (foundEntry) { |