/[svn]/linuxsampler/trunk/scripts/generate_lscp_shell_reference.pl
ViewVC logotype

Diff of /linuxsampler/trunk/scripts/generate_lscp_shell_reference.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2534 by schoenebeck, Sun Mar 9 21:34:03 2014 UTC revision 3054 by schoenebeck, Thu Dec 15 12:47:45 2016 UTC
# Line 2  Line 2 
2    
3  # Updates the built-in LSCP documentation reference of the LSCP shell.  # Updates the built-in LSCP documentation reference of the LSCP shell.
4  #  #
5  # Copyright (c) 2014 Christian Schoenebeck  # Copyright (c) 2014-2016 Christian Schoenebeck
6  #  #
7  # Extracts all sections from Documentation/lscp.xml marked with our magic  # Extracts all sections from Documentation/lscp.xml marked with our magic
8  # XML attribute "lscp_cmd=true" (and uses the section's "anchor" XML attribute  # XML attribute "lscp_cmd=true" (and uses the section's "anchor" XML attribute
# Line 10  Line 10 
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
# Line 144  package main; Line 144  package main;
144    
145  # parse command line argument(s)  # parse command line argument(s)
146  my $g_debug_xml_extract = 0;  my $g_debug_xml_extract = 0;
147  if (defined($ARGV[0]) and $ARGV[0] eq "--debug-xml-extract") {  foreach $arg (@ARGV) {
148      $g_debug_xml_extract = 1;      if ($arg eq "--debug-xml-extract") {
149            $g_debug_xml_extract = 1;
150        } elsif ($arg =~ /^--output/) { # argument --output=OUTFILE
151            my ($name, $value) = split(/=|\s+/, $arg); # key value separated by space or "=" character
152            $REFERENCE_CPP_FILE = $value;
153        }
154  }  }
155    
156  # will be populated by collectCommands()  # will be populated by collectCommands()
# Line 273  print OUT <<EOF_BLOCK; Line 278  print OUT <<EOF_BLOCK;
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   *                                                                           *   *                                                                           *
# Line 315  print OUT <<EOF_BLOCK; Line 320  print OUT <<EOF_BLOCK;
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) {

Legend:
Removed from v.2534  
changed lines
  Added in v.3054

  ViewVC Help
Powered by ViewVC