/[svn]/linuxsampler/trunk/src/network/lscp.y
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscp.y

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

revision 1245 by schoenebeck, Tue Jun 19 15:54:13 2007 UTC revision 1781 by iliev, Mon Sep 29 18:21:21 2008 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2007 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 35  Line 35 
35  #include "lscpserver.h"  #include "lscpserver.h"
36  #include "lscpevent.h"  #include "lscpevent.h"
37    
38    namespace LinuxSampler {
39    
40  // to save us typing work in the rules action definitions  // to save us typing work in the rules action definitions
41  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer
42    #define SESSION_PARAM ((yyparse_param_t*) yyparse_param)
43    #define INCREMENT_LINE { SESSION_PARAM->iLine++; SESSION_PARAM->iColumn = 0; }
44    
45  // clears input buffer  // clears input buffer
46  void restart(yyparse_param_t* pparam, int& yychar);  void restart(yyparse_param_t* pparam, int& yychar);
47  #define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar)  #define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar)
48    
 // we provide our own version of yyerror() so we don't have to link against the yacc library  
 void yyerror(const char* s);  
   
49  static char buf[1024]; // input buffer to feed the parser with new characters  static char buf[1024]; // input buffer to feed the parser with new characters
50  static int bytes = 0;  // current number of characters in the input buffer  static int bytes = 0;  // current number of characters in the input buffer
51  static int ptr   = 0;  // current position in the input buffer  static int ptr   = 0;  // current position in the input buffer
52    static String sLastError; // error message of the last error occured
53    
54  // external reference to the function which actually reads from the socket  // external reference to the function which actually reads from the socket
55  extern int GetLSCPCommand( void *buf, int max_size);  extern int GetLSCPCommand( void *buf, int max_size);
56    
57    // external reference to the function in lscpserver.cpp which returns the
58    // current session (only works because the server runs as singleton)
59    extern yyparse_param_t* GetCurrentYaccSession();
60    
61  // returns true if supplied characters has an ASCII code of 128 or higher  // returns true if supplied characters has an ASCII code of 128 or higher
62  inline bool isExtendedAsciiChar(const char c) {  inline bool isExtendedAsciiChar(const char c) {
63      return (c < 0);      return (c < 0);
# Line 72  int yylex(YYSTYPE* yylval) { Line 78  int yylex(YYSTYPE* yylval) {
78      }      }
79      // this is the next character in the input stream      // this is the next character in the input stream
80      const char c = buf[ptr++];      const char c = buf[ptr++];
81        // increment current reading position (just for verbosity / messages)
82        GetCurrentYaccSession()->iColumn++;
83      // we have to handle "normal" and "extended" ASCII characters separately      // we have to handle "normal" and "extended" ASCII characters separately
84      if (isExtendedAsciiChar(c)) {      if (isExtendedAsciiChar(c)) {
85          // workaround for characters with ASCII code higher than 127          // workaround for characters with ASCII code higher than 127
# Line 92  int octalsToNumber(char oct_digit0, char Line 100  int octalsToNumber(char oct_digit0, char
100      return atoi(d2)*8*8 + atoi(d1)*8 + atoi(d0);      return atoi(d2)*8*8 + atoi(d1)*8 + atoi(d0);
101  }  }
102    
 int hexToNumber(char hex_digit) {  
     switch (hex_digit) {  
         case '0': return 0;  
         case '1': return 1;  
         case '2': return 2;  
         case '3': return 3;  
         case '4': return 4;  
         case '5': return 5;  
         case '6': return 6;  
         case '7': return 7;  
         case '8': return 8;  
         case '9': return 9;  
         // grammar rule 'digit_hex' already forced lower case  
         case 'a': return 10;  
         case 'b': return 11;  
         case 'c': return 12;  
         case 'd': return 13;  
         case 'e': return 14;  
         case 'f': return 15;  
         default:  return 0;  
     }  
103  }  }
104    
105  int hexsToNumber(char hex_digit0, char hex_digit1 = '0') {  // we provide our own version of yyerror() so we don't have to link against the yacc library
106      return hexToNumber(hex_digit1)*16 + hexToNumber(hex_digit0);  void yyerror(const char* s);
107  }  
108    using namespace LinuxSampler;
109    
110  %}  %}
111    
112  // reentrant parser  // reentrant parser
113  %pure_parser  %pure_parser
114    
115    // tell bison to spit out verbose syntax error messages
116  %error-verbose  %error-verbose
117    
118  %token <Char> EXT_ASCII_CHAR  %token <Char> EXT_ASCII_CHAR
119    
120  %type <Char> char digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex  %type <Char> char char_base alpha_char digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex
121  %type <Dotnum> dotnum volume_value boolean  %type <Dotnum> dotnum volume_value boolean
122  %type <Number> number sampler_channel instrument_index fx_send_id audio_channel_index device_index midi_input_channel_index midi_input_port_index midi_map midi_bank midi_prog midi_ctrl  %type <Number> number sampler_channel instrument_index fx_send_id audio_channel_index device_index midi_input_channel_index midi_input_port_index midi_map midi_bank midi_prog midi_ctrl
123  %type <String> string string_escaped text text_escaped stringval stringval_escaped digits param_val_list param_val query_val pathname dirname filename map_name entry_name fx_send_name engine_name command add_instruction create_instruction destroy_instruction get_instruction list_instruction load_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type_name midi_input_type_name remove_instruction unmap_instruction set_instruction subscribe_event unsubscribe_event map_instruction reset_instruction clear_instruction find_instruction move_instruction copy_instruction scan_mode edit_instruction  %type <String> string string_escaped text text_escaped text_escaped_base stringval stringval_escaped digits param_val_list param_val query_val filename db_path map_name entry_name fx_send_name engine_name command add_instruction create_instruction destroy_instruction get_instruction list_instruction load_instruction send_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type_name midi_input_type_name remove_instruction unmap_instruction set_instruction subscribe_event unsubscribe_event map_instruction reset_instruction clear_instruction find_instruction move_instruction copy_instruction scan_mode edit_instruction format_instruction
124  %type <FillResponse> buffer_size_type  %type <FillResponse> buffer_size_type
125  %type <KeyValList> key_val_list query_val_list  %type <KeyValList> key_val_list query_val_list
126  %type <LoadMode> instr_load_mode  %type <LoadMode> instr_load_mode
127  %type <Bool> modal_arg  %type <Bool> modal_arg
128    %type <UniversalPath> path path_base path_prefix path_body
129    
130  %start input  %start input
131    
# Line 155  input                 : line LF Line 146  input                 : line LF
146                        | line CR LF                        | line CR LF
147                        ;                        ;
148    
149  line                  :  /* epsilon (empty line ignored) */ { return LSCP_DONE; }  line                  :  /* epsilon (empty line ignored) */ { INCREMENT_LINE; return LSCP_DONE; }
150                        |  comment  { return LSCP_DONE; }                        |  comment  { INCREMENT_LINE; return LSCP_DONE; }
151                        |  command  { LSCPSERVER->AnswerClient($1); return LSCP_DONE; }                        |  command  { INCREMENT_LINE; LSCPSERVER->AnswerClient($1); return LSCP_DONE; }
152                        |  error    { LSCPSERVER->AnswerClient("ERR:0:Unknown command.\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }                        |  error    { INCREMENT_LINE; LSCPSERVER->AnswerClient("ERR:0:" + sLastError + "\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }
153                        ;                        ;
154    
155  comment               :  '#'  comment               :  '#'
# Line 186  command               :  ADD SP add_inst Line 177  command               :  ADD SP add_inst
177                        |  MOVE SP move_instruction              { $$ = $3;                                                }                        |  MOVE SP move_instruction              { $$ = $3;                                                }
178                        |  COPY SP copy_instruction              { $$ = $3;                                                }                        |  COPY SP copy_instruction              { $$ = $3;                                                }
179                        |  EDIT SP edit_instruction              { $$ = $3;                                                }                        |  EDIT SP edit_instruction              { $$ = $3;                                                }
180                          |  FORMAT SP format_instruction          { $$ = $3;                                                }
181    command               :  SEND SP send_instruction              { $$ = $3;                                                }
182                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }
183                        |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }                        |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }
184                        ;                        ;
185    
186  add_instruction       :  CHANNEL                               { $$ = LSCPSERVER->AddChannel();                          }  add_instruction       :  CHANNEL                               { $$ = LSCPSERVER->AddChannel();                  }
187                        |  DB_INSTRUMENT_DIRECTORY SP pathname   { $$ = LSCPSERVER->AddDbInstrumentDirectory($3);          }                        |  DB_INSTRUMENT_DIRECTORY SP db_path    { $$ = LSCPSERVER->AddDbInstrumentDirectory($3);  }
188                        |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP pathname SP pathname        { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);  }                        |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP db_path SP filename                        { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);        }
189                        |  DB_INSTRUMENTS SP scan_mode SP pathname SP pathname                     { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);        }                        |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP FILE_AS_DIR SP db_path SP filename         { $$ = LSCPSERVER->AddDbInstruments($5,$9,$11, true, true); }
190                        |  DB_INSTRUMENTS SP NON_MODAL SP pathname SP pathname                     { $$ = LSCPSERVER->AddDbInstruments($5,$7, -1, true); }                        |  DB_INSTRUMENTS SP scan_mode SP db_path SP filename                                     { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);              }
191                        |  DB_INSTRUMENTS SP NON_MODAL SP pathname SP pathname SP instrument_index { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);  }                        |  DB_INSTRUMENTS SP scan_mode SP FILE_AS_DIR SP db_path SP filename                      { $$ = LSCPSERVER->AddDbInstruments($3,$7,$9, false, true); }
192                        |  DB_INSTRUMENTS SP pathname SP pathname                                  { $$ = LSCPSERVER->AddDbInstruments($3,$5);           }                        |  DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename                                     { $$ = LSCPSERVER->AddDbInstruments($5,$7, -1, true);       }
193                        |  DB_INSTRUMENTS SP pathname SP pathname SP instrument_index              { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);        }                        |  DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename SP instrument_index                 { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);        }
194                          |  DB_INSTRUMENTS SP db_path SP filename                                                  { $$ = LSCPSERVER->AddDbInstruments($3,$5);                 }
195                          |  DB_INSTRUMENTS SP db_path SP filename SP instrument_index                              { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);              }
196                        |  MIDI_INSTRUMENT_MAP                   { $$ = LSCPSERVER->AddMidiInstrumentMap();                }                        |  MIDI_INSTRUMENT_MAP                   { $$ = LSCPSERVER->AddMidiInstrumentMap();                }
197                        |  MIDI_INSTRUMENT_MAP SP map_name       { $$ = LSCPSERVER->AddMidiInstrumentMap($3);              }                        |  MIDI_INSTRUMENT_MAP SP map_name       { $$ = LSCPSERVER->AddMidiInstrumentMap($3);              }
198                        ;                        ;
# Line 207  subscribe_event       :  AUDIO_OUTPUT_DE Line 202  subscribe_event       :  AUDIO_OUTPUT_DE
202                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_count);    }                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_count);    }
203                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_info);     }                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_info);     }
204                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_count);        }                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_count);        }
205                          |  CHANNEL_MIDI                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_midi);         }
206                          |  DEVICE_MIDI                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_device_midi);          }
207                        |  VOICE_COUNT                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_voice_count);          }                        |  VOICE_COUNT                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_voice_count);          }
208                        |  STREAM_COUNT                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_stream_count);         }                        |  STREAM_COUNT                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_stream_count);         }
209                        |  BUFFER_FILL                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_buffer_fill);          }                        |  BUFFER_FILL                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_buffer_fill);          }
# Line 223  subscribe_event       :  AUDIO_OUTPUT_DE Line 220  subscribe_event       :  AUDIO_OUTPUT_DE
220                        |  DB_INSTRUMENT_INFO                    { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instr_info);        }                        |  DB_INSTRUMENT_INFO                    { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instr_info);        }
221                        |  DB_INSTRUMENTS_JOB_INFO               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instrs_job_info);   }                        |  DB_INSTRUMENTS_JOB_INFO               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instrs_job_info);   }
222                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_misc);                 }                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_misc);                 }
223                          |  TOTAL_STREAM_COUNT                    { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_total_stream_count);   }
224                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_total_voice_count);    }                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_total_voice_count);    }
225                        |  GLOBAL_INFO                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_global_info);          }                        |  GLOBAL_INFO                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_global_info);          }
226                        ;                        ;
# Line 232  unsubscribe_event     :  AUDIO_OUTPUT_DE Line 230  unsubscribe_event     :  AUDIO_OUTPUT_DE
230                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_count);    }                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_count);    }
231                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_info);     }                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_info);     }
232                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_count);        }                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_count);        }
233                          |  CHANNEL_MIDI                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_midi);         }
234                          |  DEVICE_MIDI                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_device_midi);          }
235                        |  VOICE_COUNT                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_voice_count);          }                        |  VOICE_COUNT                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_voice_count);          }
236                        |  STREAM_COUNT                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_stream_count);         }                        |  STREAM_COUNT                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_stream_count);         }
237                        |  BUFFER_FILL                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_buffer_fill);          }                        |  BUFFER_FILL                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_buffer_fill);          }
# Line 248  unsubscribe_event     :  AUDIO_OUTPUT_DE Line 248  unsubscribe_event     :  AUDIO_OUTPUT_DE
248                        |  DB_INSTRUMENT_INFO                    { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instr_info);        }                        |  DB_INSTRUMENT_INFO                    { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instr_info);        }
249                        |  DB_INSTRUMENTS_JOB_INFO               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instrs_job_info);   }                        |  DB_INSTRUMENTS_JOB_INFO               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instrs_job_info);   }
250                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_misc);                 }                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_misc);                 }
251                          |  TOTAL_STREAM_COUNT                    { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_total_stream_count);   }
252                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_total_voice_count);    }                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_total_voice_count);    }
253                        |  GLOBAL_INFO                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_global_info);          }                        |  GLOBAL_INFO                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_global_info);          }
254                        ;                        ;
255    
256  map_instruction       :  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,MidiInstrumentMapper::VOID,"",$3); }  map_instruction       :  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,MidiInstrumentMapper::DONTCARE,"",$3); }
257                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,$18,"",$3); }                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,$18,"",$3); }
258                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,MidiInstrumentMapper::VOID,$18,$3); }                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,MidiInstrumentMapper::DONTCARE,$18,$3); }
259                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,$18,$20,$3); }                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,$18,$20,$3); }
260                        ;                        ;
261    
262  unmap_instruction     :  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog  { $$ = LSCPSERVER->RemoveMIDIInstrumentMapping($3,$5,$7); }  unmap_instruction     :  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog  { $$ = LSCPSERVER->RemoveMIDIInstrumentMapping($3,$5,$7); }
263                        ;                        ;
264    
265  remove_instruction    :  CHANNEL SP sampler_channel                    { $$ = LSCPSERVER->RemoveChannel($3);                     }  remove_instruction    :  CHANNEL SP sampler_channel                   { $$ = LSCPSERVER->RemoveChannel($3);                      }
266                        |  MIDI_INSTRUMENT_MAP SP midi_map               { $$ = LSCPSERVER->RemoveMidiInstrumentMap($3);           }                        |  MIDI_INSTRUMENT_MAP SP midi_map              { $$ = LSCPSERVER->RemoveMidiInstrumentMap($3);            }
267                        |  MIDI_INSTRUMENT_MAP SP ALL                    { $$ = LSCPSERVER->RemoveAllMidiInstrumentMaps();         }                        |  MIDI_INSTRUMENT_MAP SP ALL                   { $$ = LSCPSERVER->RemoveAllMidiInstrumentMaps();          }
268                        |  DB_INSTRUMENT_DIRECTORY SP FORCE SP pathname  { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($5, true); }                        |  DB_INSTRUMENT_DIRECTORY SP FORCE SP db_path  { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($5, true);  }
269                        |  DB_INSTRUMENT_DIRECTORY SP pathname           { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($3);       }                        |  DB_INSTRUMENT_DIRECTORY SP db_path           { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($3);        }
270                        |  DB_INSTRUMENT SP pathname                     { $$ = LSCPSERVER->RemoveDbInstrument($3);                }                        |  DB_INSTRUMENT SP db_path                     { $$ = LSCPSERVER->RemoveDbInstrument($3);                 }
271                        ;                        ;
272    
273  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }
# Line 293  get_instruction       :  AVAILABLE_ENGIN Line 294  get_instruction       :  AVAILABLE_ENGIN
294                        |  CHANNEL SP VOICE_COUNT SP sampler_channel                                  { $$ = LSCPSERVER->GetVoiceCount($5);                              }                        |  CHANNEL SP VOICE_COUNT SP sampler_channel                                  { $$ = LSCPSERVER->GetVoiceCount($5);                              }
295                        |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }                        |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }
296                        |  SERVER SP INFO                                                             { $$ = LSCPSERVER->GetServerInfo();                                }                        |  SERVER SP INFO                                                             { $$ = LSCPSERVER->GetServerInfo();                                }
297                          |  TOTAL_STREAM_COUNT                                                         { $$ = LSCPSERVER->GetTotalStreamCount();                           }
298                        |  TOTAL_VOICE_COUNT                                                          { $$ = LSCPSERVER->GetTotalVoiceCount();                           }                        |  TOTAL_VOICE_COUNT                                                          { $$ = LSCPSERVER->GetTotalVoiceCount();                           }
299                        |  TOTAL_VOICE_COUNT_MAX                                                      { $$ = LSCPSERVER->GetTotalVoiceCountMax();                        }                        |  TOTAL_VOICE_COUNT_MAX                                                      { $$ = LSCPSERVER->GetTotalVoiceCountMax();                        }
300                        |  MIDI_INSTRUMENTS SP midi_map                                               { $$ = LSCPSERVER->GetMidiInstrumentMappings($3);                  }                        |  MIDI_INSTRUMENTS SP midi_map                                               { $$ = LSCPSERVER->GetMidiInstrumentMappings($3);                  }
# Line 302  get_instruction       :  AVAILABLE_ENGIN Line 304  get_instruction       :  AVAILABLE_ENGIN
304                        |  MIDI_INSTRUMENT_MAP SP INFO SP midi_map                                    { $$ = LSCPSERVER->GetMidiInstrumentMap($5);                       }                        |  MIDI_INSTRUMENT_MAP SP INFO SP midi_map                                    { $$ = LSCPSERVER->GetMidiInstrumentMap($5);                       }
305                        |  FX_SENDS SP sampler_channel                                                { $$ = LSCPSERVER->GetFxSends($3);                                 }                        |  FX_SENDS SP sampler_channel                                                { $$ = LSCPSERVER->GetFxSends($3);                                 }
306                        |  FX_SEND SP INFO SP sampler_channel SP fx_send_id                           { $$ = LSCPSERVER->GetFxSendInfo($5,$7);                           }                        |  FX_SEND SP INFO SP sampler_channel SP fx_send_id                           { $$ = LSCPSERVER->GetFxSendInfo($5,$7);                           }
307                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP pathname                         { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($5, true);        }                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP db_path                          { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($5, true);        }
308                        |  DB_INSTRUMENT_DIRECTORIES SP pathname                                      { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($3, false);       }                        |  DB_INSTRUMENT_DIRECTORIES SP db_path                                       { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($3, false);       }
309                        |  DB_INSTRUMENT_DIRECTORY SP INFO SP pathname                                { $$ = LSCPSERVER->GetDbInstrumentDirectoryInfo($5);               }                        |  DB_INSTRUMENT_DIRECTORY SP INFO SP db_path                                 { $$ = LSCPSERVER->GetDbInstrumentDirectoryInfo($5);               }
310                        |  DB_INSTRUMENTS SP RECURSIVE SP pathname                                    { $$ = LSCPSERVER->GetDbInstrumentCount($5, true);                 }                        |  DB_INSTRUMENTS SP RECURSIVE SP db_path                                     { $$ = LSCPSERVER->GetDbInstrumentCount($5, true);                 }
311                        |  DB_INSTRUMENTS SP pathname                                                 { $$ = LSCPSERVER->GetDbInstrumentCount($3, false);                }                        |  DB_INSTRUMENTS SP db_path                                                  { $$ = LSCPSERVER->GetDbInstrumentCount($3, false);                }
312                        |  DB_INSTRUMENT SP INFO SP pathname                                          { $$ = LSCPSERVER->GetDbInstrumentInfo($5);                        }                        |  DB_INSTRUMENT SP INFO SP db_path                                           { $$ = LSCPSERVER->GetDbInstrumentInfo($5);                        }
313                        |  DB_INSTRUMENTS_JOB SP INFO SP number                                       { $$ = LSCPSERVER->GetDbInstrumentsJobInfo($5);                    }                        |  DB_INSTRUMENTS_JOB SP INFO SP number                                       { $$ = LSCPSERVER->GetDbInstrumentsJobInfo($5);                    }
314                        |  VOLUME                                                                     { $$ = LSCPSERVER->GetGlobalVolume();                              }                        |  VOLUME                                                                     { $$ = LSCPSERVER->GetGlobalVolume();                              }
315                          |  FILE SP INSTRUMENTS SP filename                                            { $$ = LSCPSERVER->GetFileInstruments($5);                         }
316                          |  FILE SP INSTRUMENT SP INFO SP filename SP instrument_index                 { $$ = LSCPSERVER->GetFileInstrumentInfo($7,$9);                   }
317                        ;                        ;
318    
319  set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }  set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }
320                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP number SP number SP string '=' param_val_list  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP number SP number SP string '=' param_val_list  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }
321                        |  MIDI_INPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list               { $$ = LSCPSERVER->SetMidiInputDeviceParameter($3, $5, $7);        }                        |  MIDI_INPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list               { $$ = LSCPSERVER->SetMidiInputDeviceParameter($3, $5, $7);        }
322                          |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' NONE                 { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, "");      }
323                        |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' param_val_list       { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, $9);      }                        |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' param_val_list       { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, $9);      }
324                        |  CHANNEL SP set_chan_instruction                                                  { $$ = $3;                                                         }                        |  CHANNEL SP set_chan_instruction                                                  { $$ = $3;                                                         }
325                        |  MIDI_INSTRUMENT_MAP SP NAME SP midi_map SP map_name                              { $$ = LSCPSERVER->SetMidiInstrumentMapName($5, $7);               }                        |  MIDI_INSTRUMENT_MAP SP NAME SP midi_map SP map_name                              { $$ = LSCPSERVER->SetMidiInstrumentMapName($5, $7);               }
# Line 322  set_instruction       :  AUDIO_OUTPUT_DE Line 327  set_instruction       :  AUDIO_OUTPUT_DE
327                        |  FX_SEND SP AUDIO_OUTPUT_CHANNEL SP sampler_channel SP fx_send_id SP audio_channel_index SP audio_channel_index  { $$ = LSCPSERVER->SetFxSendAudioOutputChannel($5,$7,$9,$11); }                        |  FX_SEND SP AUDIO_OUTPUT_CHANNEL SP sampler_channel SP fx_send_id SP audio_channel_index SP audio_channel_index  { $$ = LSCPSERVER->SetFxSendAudioOutputChannel($5,$7,$9,$11); }
328                        |  FX_SEND SP MIDI_CONTROLLER SP sampler_channel SP fx_send_id SP midi_ctrl         { $$ = LSCPSERVER->SetFxSendMidiController($5,$7,$9);              }                        |  FX_SEND SP MIDI_CONTROLLER SP sampler_channel SP fx_send_id SP midi_ctrl         { $$ = LSCPSERVER->SetFxSendMidiController($5,$7,$9);              }
329                        |  FX_SEND SP LEVEL SP sampler_channel SP fx_send_id SP volume_value                { $$ = LSCPSERVER->SetFxSendLevel($5,$7,$9);                       }                        |  FX_SEND SP LEVEL SP sampler_channel SP fx_send_id SP volume_value                { $$ = LSCPSERVER->SetFxSendLevel($5,$7,$9);                       }
330                        |  DB_INSTRUMENT_DIRECTORY SP NAME SP pathname SP dirname                           { $$ = LSCPSERVER->SetDbInstrumentDirectoryName($5,$7);            }                        |  DB_INSTRUMENT_DIRECTORY SP NAME SP db_path SP stringval_escaped                  { $$ = LSCPSERVER->SetDbInstrumentDirectoryName($5,$7);            }
331                        |  DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP pathname SP stringval                  { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7);     }                        |  DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP db_path SP stringval_escaped           { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7);     }
332                        |  DB_INSTRUMENT SP NAME SP pathname SP dirname                                     { $$ = LSCPSERVER->SetDbInstrumentName($5,$7);                     }                        |  DB_INSTRUMENT SP NAME SP db_path SP stringval_escaped                            { $$ = LSCPSERVER->SetDbInstrumentName($5,$7);                     }
333                        |  DB_INSTRUMENT SP DESCRIPTION SP pathname SP stringval                            { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7);              }                        |  DB_INSTRUMENT SP DESCRIPTION SP db_path SP stringval_escaped                     { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7);              }
334                          |  DB_INSTRUMENT SP FILE_PATH SP filename SP filename                               { $$ = LSCPSERVER->SetDbInstrumentFilePath($5,$7);                 }
335                        |  ECHO SP boolean                                                                  { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }                        |  ECHO SP boolean                                                                  { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }
336                        |  VOLUME SP volume_value                                                           { $$ = LSCPSERVER->SetGlobalVolume($3);                            }                        |  VOLUME SP volume_value                                                           { $$ = LSCPSERVER->SetGlobalVolume($3);                            }
337                        ;                        ;
# Line 345  clear_instruction     :  MIDI_INSTRUMENT Line 351  clear_instruction     :  MIDI_INSTRUMENT
351                        |  MIDI_INSTRUMENTS SP ALL        { $$ = LSCPSERVER->ClearAllMidiInstrumentMappings(); }                        |  MIDI_INSTRUMENTS SP ALL        { $$ = LSCPSERVER->ClearAllMidiInstrumentMappings(); }
352                        ;                        ;
353    
354  find_instruction      :  DB_INSTRUMENTS SP NON_RECURSIVE SP pathname SP query_val_list             { $$ = LSCPSERVER->FindDbInstruments($5,$7, false);           }  find_instruction      :  DB_INSTRUMENTS SP NON_RECURSIVE SP db_path SP query_val_list              { $$ = LSCPSERVER->FindDbInstruments($5,$7, false);           }
355                        |  DB_INSTRUMENTS SP pathname SP query_val_list                              { $$ = LSCPSERVER->FindDbInstruments($3,$5, true);            }                        |  DB_INSTRUMENTS SP db_path SP query_val_list                               { $$ = LSCPSERVER->FindDbInstruments($3,$5, true);            }
356                        |  DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP pathname SP query_val_list  { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); }                        |  DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP db_path SP query_val_list   { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); }
357                        |  DB_INSTRUMENT_DIRECTORIES SP pathname SP query_val_list                   { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true);  }                        |  DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list                    { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true);  }
358                          |  LOST SP DB_INSTRUMENT_FILES                                               { $$ = LSCPSERVER->FindLostDbInstrumentFiles();                 }
359                        ;                        ;
360    
361  move_instruction      :  DB_INSTRUMENT_DIRECTORY SP pathname SP pathname  { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); }  move_instruction      :  DB_INSTRUMENT_DIRECTORY SP db_path SP db_path    { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); }
362                        |  DB_INSTRUMENT SP pathname SP pathname            { $$ = LSCPSERVER->MoveDbInstrument($3,$5);          }                        |  DB_INSTRUMENT SP db_path SP db_path              { $$ = LSCPSERVER->MoveDbInstrument($3,$5);          }
363                        ;                        ;
364    
365  copy_instruction      :  DB_INSTRUMENT_DIRECTORY SP pathname SP pathname  { $$ = LSCPSERVER->CopyDbInstrumentDirectory($3,$5); }  copy_instruction      :  DB_INSTRUMENT_DIRECTORY SP db_path SP db_path    { $$ = LSCPSERVER->CopyDbInstrumentDirectory($3,$5); }
366                        |  DB_INSTRUMENT SP pathname SP pathname            { $$ = LSCPSERVER->CopyDbInstrument($3,$5);          }                        |  DB_INSTRUMENT SP db_path SP db_path              { $$ = LSCPSERVER->CopyDbInstrument($3,$5);          }
367                        ;                        ;
368    
369  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }
# Line 384  set_chan_instruction  :  AUDIO_OUTPUT_DE Line 391  set_chan_instruction  :  AUDIO_OUTPUT_DE
391                        |  MIDI_INSTRUMENT_MAP SP sampler_channel SP DEFAULT                                                   { $$ = LSCPSERVER->SetChannelMap($3, -2);             }                        |  MIDI_INSTRUMENT_MAP SP sampler_channel SP DEFAULT                                                   { $$ = LSCPSERVER->SetChannelMap($3, -2);             }
392                        ;                        ;
393    
394  edit_instruction      :  INSTRUMENT SP sampler_channel  { $$ = LSCPSERVER->EditSamplerChannelInstrument($3); }  edit_instruction      :  CHANNEL SP INSTRUMENT SP sampler_channel  { $$ = LSCPSERVER->EditSamplerChannelInstrument($5); }
395                          ;
396    
397    format_instruction    :  INSTRUMENTS_DB  { $$ = LSCPSERVER->FormatInstrumentsDb(); }
398                        ;                        ;
399    
400  modal_arg             :  /* epsilon (empty argument) */  { $$ = true;  }  modal_arg             :  /* epsilon (empty argument) */  { $$ = true;  }
# Line 409  list_instruction      :  AUDIO_OUTPUT_DE Line 419  list_instruction      :  AUDIO_OUTPUT_DE
419                        |  MIDI_INSTRUMENTS SP ALL                            { $$ = LSCPSERVER->ListAllMidiInstrumentMappings();      }                        |  MIDI_INSTRUMENTS SP ALL                            { $$ = LSCPSERVER->ListAllMidiInstrumentMappings();      }
420                        |  MIDI_INSTRUMENT_MAPS                               { $$ = LSCPSERVER->ListMidiInstrumentMaps();             }                        |  MIDI_INSTRUMENT_MAPS                               { $$ = LSCPSERVER->ListMidiInstrumentMaps();             }
421                        |  FX_SENDS SP sampler_channel                        { $$ = LSCPSERVER->ListFxSends($3);                      }                        |  FX_SENDS SP sampler_channel                        { $$ = LSCPSERVER->ListFxSends($3);                      }
422                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP pathname { $$ = LSCPSERVER->GetDbInstrumentDirectories($5, true); }                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP db_path  { $$ = LSCPSERVER->GetDbInstrumentDirectories($5, true); }
423                        |  DB_INSTRUMENT_DIRECTORIES SP pathname              { $$ = LSCPSERVER->GetDbInstrumentDirectories($3);       }                        |  DB_INSTRUMENT_DIRECTORIES SP db_path               { $$ = LSCPSERVER->GetDbInstrumentDirectories($3);       }
424                        |  DB_INSTRUMENTS SP RECURSIVE SP pathname            { $$ = LSCPSERVER->GetDbInstruments($5, true);           }                        |  DB_INSTRUMENTS SP RECURSIVE SP db_path             { $$ = LSCPSERVER->GetDbInstruments($5, true);           }
425                        |  DB_INSTRUMENTS SP pathname                         { $$ = LSCPSERVER->GetDbInstruments($3);                 }                        |  DB_INSTRUMENTS SP db_path                          { $$ = LSCPSERVER->GetDbInstruments($3);                 }
426                          |  FILE SP INSTRUMENTS SP filename                    { $$ = LSCPSERVER->ListFileInstruments($5);              }
427                          ;
428    
429    send_instruction      :  CHANNEL SP MIDI_DATA SP string SP sampler_channel SP number SP number  { $$ = LSCPSERVER->SendChannelMidiData($5, $7, $9, $11); }
430                        ;                        ;
431    
432  load_instr_args       :  filename SP instrument_index SP sampler_channel               { $$ = LSCPSERVER->LoadInstrument($1, $3, $5);       }  load_instr_args       :  filename SP instrument_index SP sampler_channel               { $$ = LSCPSERVER->LoadInstrument($1, $3, $5);       }
# Line 474  fx_send_id                :  number Line 488  fx_send_id                :  number
488  engine_name               :  string  engine_name               :  string
489                            ;                            ;
490    
491  pathname                  :  stringval  filename                  :  path  {
492                            ;                                   #if WIN32
493                                     $$ = $1.toWindows();
494  dirname                   :  stringval                                   #else
495                                     // assuming POSIX
496                                     $$ = $1.toPosix();
497                                     #endif
498                                 }
499                            ;                            ;
500    
501  filename                  :  stringval_escaped  db_path                   :  path  { $$ = $1.toDbPath(); }
502                            ;                            ;
503    
504  map_name                  :  stringval  map_name                  :  stringval_escaped
505                            ;                            ;
506    
507  entry_name                :  stringval  entry_name                :  stringval_escaped
508                            ;                            ;
509    
510  fx_send_name              :  stringval  fx_send_name              :  stringval_escaped
511                            ;                            ;
512    
513  param_val_list            :  param_val  param_val_list            :  param_val
514                            |  param_val_list','param_val  { $$ = $1 + "," + $3; }                            |  param_val_list','param_val  { $$ = $1 + "," + $3; }
515                            ;                            ;
516    
517  param_val                 :  string  //TODO: the re-encapsulation into apostrophes for string and strinval here is a hack, since we need a way for __parse_strings() (DeviceParameters.cpp) to distinguish a comma separated list of strings and a string which contains commas. A clean solution would be to move those parser jobs over here to lscp.y
518                            |  stringval  param_val                 :  string            { $$ = "\'" + $1 + "\'"; }
519                              |  stringval         { $$ = "\'" + $1 + "\'"; }
520                            |  number            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }                            |  number            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }
521                            |  dotnum            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }                            |  dotnum            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }
522                            ;                            ;
# Line 506  query_val_list            :  string '=' Line 525  query_val_list            :  string '='
525                            |  query_val_list SP string '=' query_val  { $$ = $1; $$[$3] = $5; }                            |  query_val_list SP string '=' query_val  { $$ = $1; $$[$3] = $5; }
526                            ;                            ;
527    
528  query_val                 :  string  query_val                 :  text_escaped
529                            |  stringval                            |  stringval_escaped
530                            ;                            ;
531    
532  scan_mode                 :  RECURSIVE      { $$ = "RECURSIVE"; }  scan_mode                 :  RECURSIVE      { $$ = "RECURSIVE"; }
# Line 524  boolean               :  number  { $$ = Line 543  boolean               :  number  { $$ =
543                        |  string  { $$ = -1; }                        |  string  { $$ = -1; }
544                        ;                        ;
545    
546  string                :  char          { std::string s; s = $1; $$ = s; }  dotnum                :      digits '.' digits  { std::stringstream ss($1 + "." + $3); ss.imbue(std::locale::classic()); ss >> $$; }
547                        |  '\\'          { $$ = "\\";                     } // we have to place this rule here, because we currently distinguish between escaped and unescaped strings                        |  '+' digits '.' digits  { std::stringstream ss($2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
548                        |  string char   { $$ = $1 + $2;                  }                        |  '-' digits '.' digits  { std::stringstream ss("-" + $2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
                       ;  
   
 string_escaped        :  char                        { std::string s; s = $1; $$ = s; }  
                       |  escape_seq                  { std::string s; s = $1; $$ = s; }  
                       |  string_escaped char         { $$ = $1 + $2;                  }  
                       |  string_escaped escape_seq   { $$ = $1 + $2;                  }  
                       ;  
   
 dotnum                :      digits '.' digits  { $$ = atof(String($1 + "." + $3).c_str());                         }  
                       |  '+' digits '.' digits  { String s = "+"; s += $2; s += "."; s += $4; $$ = atof(s.c_str()); }  
                       |  '-' digits '.' digits  { $$ = atof(String("-" + $2 + "." + $4).c_str());                   }  
549                        ;                        ;
550    
551    
# Line 601  number                :  digit       { $ Line 609  number                :  digit       { $
609                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }
610                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }
611                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }
612                          ;
613    
614  char                  :  'A' { $$ = 'A'; } | 'B' { $$ = 'B'; } | 'C' { $$ = 'C'; } | 'D' { $$ = 'D'; } | 'E' { $$ = 'E'; } | 'F' { $$ = 'F'; } | 'G' { $$ = 'G'; } | 'H' { $$ = 'H'; } | 'I' { $$ = 'I'; } | 'J' { $$ = 'J'; } | 'K' { $$ = 'K'; } | 'L' { $$ = 'L'; } | 'M' { $$ = 'M'; } | 'N' { $$ = 'N'; } | 'O' { $$ = 'O'; } | 'P' { $$ = 'P'; } | 'Q' { $$ = 'Q'; } | 'R' { $$ = 'R'; } | 'S' { $$ = 'S'; } | 'T' { $$ = 'T'; } | 'U' { $$ = 'U'; } | 'V' { $$ = 'V'; } | 'W' { $$ = 'W'; } | 'X' { $$ = 'X'; } | 'Y' { $$ = 'Y'; } | 'Z' { $$ = 'Z'; }  path                  :  '\'' path_base '\''  { $$ = $2; }
615                        |  'a' { $$ = 'a'; } | 'b' { $$ = 'b'; } | 'c' { $$ = 'c'; } | 'd' { $$ = 'd'; } | 'e' { $$ = 'e'; } | 'f' { $$ = 'f'; } | 'g' { $$ = 'g'; } | 'h' { $$ = 'h'; } | 'i' { $$ = 'i'; } | 'j' { $$ = 'j'; } | 'k' { $$ = 'k'; } | 'l' { $$ = 'l'; } | 'm' { $$ = 'm'; } | 'n' { $$ = 'n'; } | 'o' { $$ = 'o'; } | 'p' { $$ = 'p'; } | 'q' { $$ = 'q'; } | 'r' { $$ = 'r'; } | 's' { $$ = 's'; } | 't' { $$ = 't'; } | 'u' { $$ = 'u'; } | 'v' { $$ = 'v'; } | 'w' { $$ = 'w'; } | 'x' { $$ = 'x'; } | 'y' { $$ = 'y'; } | 'z' { $$ = 'z'; }                        |  '\"' path_base '\"'  { $$ = $2; }
616                        |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }                        ;
617                        |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; } | '/' { $$ = '/'; }  
618                        |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }  path_base             :  path_prefix path_body  { $$ = $1 + $2; }
619                        |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }                        ;
620                        |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }  
621                        |  EXT_ASCII_CHAR  path_prefix           :  '/'                 { $$ = Path();                    }
622                          |  alpha_char ':' '/'  { Path p; p.setDrive($1); $$ = p; }
623                          ;
624    
625    path_body             :  /* epsilon (empty argument) */ { $$ = Path();                           }
626                          |  path_body '/'                  { $$ = $1;                               }
627                          |  path_body text_escaped_base    { Path p; p.appendNode($2); $$ = $1 + p; }
628                          ;
629    
630    stringval             :  '\'' text '\''  { $$ = $2; }
631                          |  '\"' text '\"'  { $$ = $2; }
632                          ;
633    
634    stringval_escaped     :  '\'' text_escaped '\''  { $$ = $2; }
635                          |  '\"' text_escaped '\"'  { $$ = $2; }
636                        ;                        ;
637    
638  text                  :  SP           { $$ = " ";      }  text                  :  SP           { $$ = " ";      }
# Line 618  text                  :  SP           { Line 641  text                  :  SP           {
641                        |  text string  { $$ = $1 + $2;  }                        |  text string  { $$ = $1 + $2;  }
642                        ;                        ;
643    
644  text_escaped          :  SP                           { $$ = " ";      }  // like text_escaped, but missing the slash ('/') character
645    text_escaped_base     :  SP                                { $$ = " ";      }
646                        |  string_escaped                        |  string_escaped
647                        |  text_escaped SP              { $$ = $1 + " "; }                        |  text_escaped_base SP              { $$ = $1 + " "; }
648                        |  text_escaped string_escaped  { $$ = $1 + $2;  }                        |  text_escaped_base string_escaped  { $$ = $1 + $2;  }
649                        ;                        ;
650    
651  stringval             :  '\'' text '\''  { $$ = $2; }  text_escaped          :  '/'                              { $$ = "/";      }
652                        |  '\"' text '\"'  { $$ = $2; }                        |  text_escaped_base
653                          |  text_escaped '/'                 { $$ = $1 + "/"; }
654                          |  text_escaped text_escaped_base   { $$ = $1 + $2;  }
655                        ;                        ;
656    
657  stringval_escaped     :  '\'' text_escaped '\''  { $$ = $2; }  string                :  char          { std::string s; s = $1; $$ = s; }
658                        |  '\"' text_escaped '\"'  { $$ = $2; }                        |  string char   { $$ = $1 + $2;                  }
659                          ;
660    
661    string_escaped        :  char_base                   { std::string s; s = $1; $$ = s; }
662                          |  escape_seq                  { std::string s; s = $1; $$ = s; }
663                          |  string_escaped char_base    { $$ = $1 + $2;                  }
664                          |  string_escaped escape_seq   { $$ = $1 + $2;                  }
665                          ;
666    
667    // full ASCII character set except space, quotation mark and apostrophe
668    char                  :  char_base
669                          |  '\\'  { $$ = '\\'; }
670                          |  '/'   { $$ = '/';  }
671                          ;
672    
673    // characters A..Z and a..z
674    alpha_char            :  'A' { $$ = 'A'; } | 'B' { $$ = 'B'; } | 'C' { $$ = 'C'; } | 'D' { $$ = 'D'; } | 'E' { $$ = 'E'; } | 'F' { $$ = 'F'; } | 'G' { $$ = 'G'; } | 'H' { $$ = 'H'; } | 'I' { $$ = 'I'; } | 'J' { $$ = 'J'; } | 'K' { $$ = 'K'; } | 'L' { $$ = 'L'; } | 'M' { $$ = 'M'; } | 'N' { $$ = 'N'; } | 'O' { $$ = 'O'; } | 'P' { $$ = 'P'; } | 'Q' { $$ = 'Q'; } | 'R' { $$ = 'R'; } | 'S' { $$ = 'S'; } | 'T' { $$ = 'T'; } | 'U' { $$ = 'U'; } | 'V' { $$ = 'V'; } | 'W' { $$ = 'W'; } | 'X' { $$ = 'X'; } | 'Y' { $$ = 'Y'; } | 'Z' { $$ = 'Z'; }
675                          |  'a' { $$ = 'a'; } | 'b' { $$ = 'b'; } | 'c' { $$ = 'c'; } | 'd' { $$ = 'd'; } | 'e' { $$ = 'e'; } | 'f' { $$ = 'f'; } | 'g' { $$ = 'g'; } | 'h' { $$ = 'h'; } | 'i' { $$ = 'i'; } | 'j' { $$ = 'j'; } | 'k' { $$ = 'k'; } | 'l' { $$ = 'l'; } | 'm' { $$ = 'm'; } | 'n' { $$ = 'n'; } | 'o' { $$ = 'o'; } | 'p' { $$ = 'p'; } | 'q' { $$ = 'q'; } | 'r' { $$ = 'r'; } | 's' { $$ = 's'; } | 't' { $$ = 't'; } | 'u' { $$ = 'u'; } | 'v' { $$ = 'v'; } | 'w' { $$ = 'w'; } | 'x' { $$ = 'x'; } | 'y' { $$ = 'y'; } | 'z' { $$ = 'z'; }
676                          ;
677    
678    // ASCII characters except space, quotation mark, apostrophe, backslash and slash
679    char_base             :  alpha_char
680                          |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }
681                          |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; }
682                          |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }
683                          |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }
684                          |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }
685                          |  EXT_ASCII_CHAR
686                        ;                        ;
687    
688  escape_seq            :  '\\' '\''  { $$ = '\''; }  escape_seq            :  '\\' '\''  { $$ = '\''; }
689                        |  '\\' '\"'  { $$ = '\"'; }                        |  '\\' '\"'  { $$ = '\"'; }
690                        |  '\\' '\\'  { $$ = '\\'; }                        |  '\\' '\\'  { $$ = '\\'; }
691                          |  '\\' '/'   { $$ = '/';  }
692                        |  '\\' 'n'   { $$ = '\n'; }                        |  '\\' 'n'   { $$ = '\n'; }
693                        |  '\\' 'r'   { $$ = '\r'; }                        |  '\\' 'r'   { $$ = '\r'; }
694                        |  '\\' 'f'   { $$ = '\f'; }                        |  '\\' 'f'   { $$ = '\f'; }
# Line 682  CLEAR                 :  'C''L''E''A''R' Line 736  CLEAR                 :  'C''L''E''A''R'
736  FIND                  :  'F''I''N''D'  FIND                  :  'F''I''N''D'
737                        ;                        ;
738    
739    FILE_AS_DIR           :  'F''I''L''E''_''A''S''_''D''I''R'
740                          ;
741    
742  MOVE                  :  'M''O''V''E'  MOVE                  :  'M''O''V''E'
743                        ;                        ;
744    
# Line 775  DB_INSTRUMENT_COUNT           :  'D''B'' Line 832  DB_INSTRUMENT_COUNT           :  'D''B''
832  DB_INSTRUMENT_INFO            :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O'  DB_INSTRUMENT_INFO            :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O'
833                                ;                                ;
834    
835    DB_INSTRUMENT_FILES           :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''F''I''L''E''S'
836                                  ;
837    
838  DB_INSTRUMENTS_JOB_INFO       :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B''_''I''N''F''O'  DB_INSTRUMENTS_JOB_INFO       :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B''_''I''N''F''O'
839                                ;                                ;
840    
841  CHANNEL_COUNT        :  'C''H''A''N''N''E''L''_''C''O''U''N''T'  CHANNEL_COUNT        :  'C''H''A''N''N''E''L''_''C''O''U''N''T'
842                       ;                       ;
843    
844    CHANNEL_MIDI         :  'C''H''A''N''N''E''L''_''M''I''D''I'
845                         ;
846    
847    DEVICE_MIDI          :  'D''E''V''I''C''E''_''M''I''D''I'
848                         ;
849    
850  CHANNEL_INFO         :  'C''H''A''N''N''E''L''_''I''N''F''O'  CHANNEL_INFO         :  'C''H''A''N''N''E''L''_''I''N''F''O'
851                       ;                       ;
852    
# Line 799  STREAM_COUNT         :  'S''T''R''E''A'' Line 865  STREAM_COUNT         :  'S''T''R''E''A''
865  VOICE_COUNT          :  'V''O''I''C''E''_''C''O''U''N''T'  VOICE_COUNT          :  'V''O''I''C''E''_''C''O''U''N''T'
866                       ;                       ;
867    
868    TOTAL_STREAM_COUNT   :  'T''O''T''A''L''_''S''T''R''E''A''M''_''C''O''U''N''T'
869                         ;
870    
871  TOTAL_VOICE_COUNT    :  'T''O''T''A''L''_''V''O''I''C''E''_''C''O''U''N''T'  TOTAL_VOICE_COUNT    :  'T''O''T''A''L''_''V''O''I''C''E''_''C''O''U''N''T'
872                       ;                       ;
873    
# Line 811  GLOBAL_INFO          :  'G''L''O''B''A'' Line 880  GLOBAL_INFO          :  'G''L''O''B''A''
880  INSTRUMENT           :  'I''N''S''T''R''U''M''E''N''T'  INSTRUMENT           :  'I''N''S''T''R''U''M''E''N''T'
881                       ;                       ;
882    
883    INSTRUMENTS          :  'I''N''S''T''R''U''M''E''N''T''S'
884                         ;
885    
886  ENGINE               :  'E' 'N' 'G' 'I' 'N' 'E'  ENGINE               :  'E' 'N' 'G' 'I' 'N' 'E'
887                       ;                       ;
888    
# Line 895  MIDI_INPUT            :  'M''I''D''I''_' Line 967  MIDI_INPUT            :  'M''I''D''I''_'
967  MIDI_CONTROLLER       :  'M''I''D''I''_''C''O''N''T''R''O''L''L''E''R'  MIDI_CONTROLLER       :  'M''I''D''I''_''C''O''N''T''R''O''L''L''E''R'
968                        ;                        ;
969    
970    SEND                  :  'S''E''N''D'
971                          ;
972    
973  FX_SEND               :  'F''X''_''S''E''N''D'  FX_SEND               :  'F''X''_''S''E''N''D'
974                        ;                        ;
975    
# Line 916  DB_INSTRUMENT              :  'D''B''_'' Line 991  DB_INSTRUMENT              :  'D''B''_''
991  DB_INSTRUMENTS_JOB         :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B'  DB_INSTRUMENTS_JOB         :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B'
992                             ;                             ;
993    
994    INSTRUMENTS_DB             :  'I''N''S''T''R''U''M''E''N''T''S''_''D''B'
995                               ;
996    
997  DESCRIPTION                :  'D''E''S''C''R''I''P''T''I''O''N'  DESCRIPTION                :  'D''E''S''C''R''I''P''T''I''O''N'
998                             ;                             ;
999    
# Line 931  RECURSIVE                  :  'R''E''C'' Line 1009  RECURSIVE                  :  'R''E''C''
1009  NON_RECURSIVE              :  'N''O''N''_''R''E''C''U''R''S''I''V''E'  NON_RECURSIVE              :  'N''O''N''_''R''E''C''U''R''S''I''V''E'
1010                             ;                             ;
1011    
1012    LOST                       :  'L''O''S''T'
1013                               ;
1014    
1015    FILE_PATH                  :  'F''I''L''E''_''P''A''T''H'
1016                               ;
1017    
1018  SERVER                :  'S''E''R''V''E''R'  SERVER                :  'S''E''R''V''E''R'
1019                        ;                        ;
1020    
# Line 952  BYTES                 :  'B''Y''T''E''S' Line 1036  BYTES                 :  'B''Y''T''E''S'
1036  PERCENTAGE            :  'P''E''R''C''E''N''T''A''G''E'  PERCENTAGE            :  'P''E''R''C''E''N''T''A''G''E'
1037                        ;                        ;
1038    
1039    FILE                  :  'F''I''L''E'
1040                          ;
1041    
1042  EDIT                  :  'E''D''I''T'  EDIT                  :  'E''D''I''T'
1043                        ;                        ;
1044    
1045    FORMAT                :  'F''O''R''M''A''T'
1046                          ;
1047    
1048    MIDI_DATA             :  'M''I''D''I''_''D''A''T''A'
1049                          ;
1050    
1051  RESET                 :  'R''E''S''E''T'  RESET                 :  'R''E''S''E''T'
1052                        ;                        ;
1053    
# Line 976  QUIT                  :  'Q''U''I''T' Line 1069  QUIT                  :  'Q''U''I''T'
1069   * Will be called when an error occured (usually syntax error).   * Will be called when an error occured (usually syntax error).
1070   */   */
1071  void yyerror(const char* s) {  void yyerror(const char* s) {
1072      dmsg(2,("LSCPParser: %s\n", s));      yyparse_param_t* param = GetCurrentYaccSession();
1073        String msg = s
1074            + (" (line:"   + ToString(param->iLine+1))
1075            + ( ",column:" + ToString(param->iColumn))
1076            + ")";
1077        dmsg(2,("LSCPParser: %s\n", msg.c_str()));
1078        sLastError = msg;
1079  }  }
1080    
1081    namespace LinuxSampler {
1082    
1083  /**  /**
1084   * Clears input buffer.   * Clears input buffer.
1085   */   */
1086  void restart(yyparse_param_t* pparam, int& yychar) {  void restart(yyparse_param_t* pparam, int& yychar) {
1087      bytes = 0;      bytes = 0;
1088      ptr   = 0;      ptr   = 0;
1089        sLastError = "";
1090    }
1091    
1092  }  }

Legend:
Removed from v.1245  
changed lines
  Added in v.1781

  ViewVC Help
Powered by ViewVC