/[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 143 by capela, Wed Jun 23 18:54:08 2004 UTC revision 411 by schoenebeck, Sat Feb 26 02:01:14 2005 UTC
# Line 20  Line 20 
20   *   MA  02111-1307  USA                                                   *   *   MA  02111-1307  USA                                                   *
21   ***************************************************************************/   ***************************************************************************/
22    
23    /* Note: don't forget to run 'make parser' after you changed this file, */
24    /*       otherwise the parser will not be regenerated!                  */
25    
26  %{  %{
27    
28  #include "lscpparser.h"  #include "lscpparser.h"
29  #include "lscpserver.h"  #include "lscpserver.h"
30    #include "lscpevent.h"
 // as we need an reentrant scanner, we have to pass the pointer to the scanner with each yylex() call  
 #define YYLEX_PARAM ((yyparse_param_t*) yyparse_param)->pScanner  
31    
32  // to save us typing work in the rules action definitions  // to save us typing work in the rules action definitions
33  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer
34    
35  // clears input buffer and restarts scanner.  // clears input buffer
36  void restart(yyparse_param_t* pparam, int& yychar);  void restart(yyparse_param_t* pparam, int& yychar);
37  #define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar)  #define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar)
38    
 // external reference to the main scanner function yylex()  
 extern YY_DECL;  
   
 // external reference to restart the lex scanner  
 extern void yyrestart(FILE* input_file, yyscan_t yyscanner);  
   
39  // we provide our own version of yyerror() so we don't have to link against the yacc library  // we provide our own version of yyerror() so we don't have to link against the yacc library
40  void yyerror(const char* s);  void yyerror(const char* s);
41    
42    static char buf[1024]; // input buffer to feed the parser with new characters
43    static int bytes = 0;  // current number of characters in the input buffer
44    static int ptr   = 0;  // current position in the input buffer
45    
46    // external reference to the function which actually reads from the socket
47    extern int GetLSCPCommand( void *buf, int max_size);
48    
49    // custom scanner function which reads from the socket
50    int yylex(YYSTYPE* yylval) {
51        // check if we have to read new characters
52        if (ptr >= bytes) {
53            bytes = GetLSCPCommand(buf, 1023);
54            ptr   = 0;
55            if (bytes < 0) {
56                bytes = 0;
57                return 0;
58            }
59        }
60        return (int) buf[ptr++];
61    }
62    
63  %}  %}
64    
65  // reentrant parser  // reentrant parser
66  %pure_parser  %pure_parser
67    
68  %token <Char>   CHAR  %type <Char> char digit
69  %token <Dotnum> DOTNUM  %type <Dotnum> dotnum volume_value boolean
70  %token <Number> NUMBER  %type <Number> number sampler_channel instrument_index audio_channel_index device_index midi_input_channel_index midi_input_port_index
71  %token <String> STRINGVAL  %type <String> string text stringval digits param_val filename engine_name command 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 set_instruction subscribe_event unsubscribe_event
 %token SP LF CR HASH EQ  
 %token ADD GET CREATE DESTROY LIST LOAD NON_MODAL REMOVE SET SUBSCRIBE UNSUBSCRIBE RESET QUIT  
 %token CHANNEL NOTIFICATION  
 %token AVAILABLE_ENGINES AVAILABLE_AUDIO_OUTPUT_DRIVERS CHANNELS INFO BUFFER_FILL STREAM_COUNT VOICE_COUNT  
 %token INSTRUMENT ENGINE  
 %token AUDIO_OUTPUT_CHANNEL AUDIO_OUTPUT_CHANNEL_PARAMETER AUDIO_OUTPUT_DEVICE AUDIO_OUTPUT_DEVICES AUDIO_OUTPUT_DEVICE_PARAMETER AUDIO_OUTPUT_DRIVER AUDIO_OUTPUT_DRIVER_PARAMETER AUDIO_OUTPUT_TYPE MIDI_INPUT_PORT MIDI_INPUT_CHANNEL MIDI_INPUT_TYPE VOLUME  
 %token BYTES PERCENTAGE  
 %token MISCELLANEOUS  
   
 %type <Dotnum> volume  
 %type <Number> sampler_channel instrument_index audio_output_channel midi_input_channel  
 %type <String> string param_val filename engine_name midi_input_port command create_instruction destroy_instruction get_instruction list_instruction load_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type midi_input_type set_instruction subscribe_event unsubscribe_event  
72  %type <FillResponse> buffer_size_type  %type <FillResponse> buffer_size_type
73  %type <KeyValList> key_val_list  %type <KeyValList> key_val_list
74    
# Line 74  void yyerror(const char* s); Line 78  void yyerror(const char* s);
78    
79  //TODO: return more meaningful error messages  //TODO: return more meaningful error messages
80    
81  input                 :  line  input                 : line LF
82                        |  input LF line                        | line CR LF
                       |  input CR LF line  
83                        ;                        ;
84    
85  line                  :  /* epsilon (empty line ignored) */  line                  :  /* epsilon (empty line ignored) */ { return LSCP_DONE; }
86                        |  comment                        |  comment  { return LSCP_DONE; }
87                        |  command  { LSCPSERVER->AnswerClient($1); }                        |  command  { LSCPSERVER->AnswerClient($1); return LSCP_DONE; }
88                        |  error    { LSCPSERVER->AnswerClient("Err:0:Unknown command.\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }                        |  error    { LSCPSERVER->AnswerClient("Err:0:Unknown command.\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }
89                        ;                        ;
90    
91  comment               :  HASH  comment               :  '#'
92                        |  comment HASH                        |  comment '#'
93                        |  comment SP                        |  comment SP
94                        |  comment NUMBER                        |  comment number
95                        |  comment string                        |  comment string
96                        ;                        ;
97    
98  command               :  ADD SP CHANNEL                             { $$ = LSCPSERVER->AddChannel();                  }  command               :  ADD SP CHANNEL                        { $$ = LSCPSERVER->AddChannel();                          }
99                        |  GET SP get_instruction                     { $$ = $3;                                        }                        |  GET SP get_instruction                { $$ = $3;                                                }
100                        |  CREATE SP create_instruction               { $$ = $3;                                        }                        |  CREATE SP create_instruction          { $$ = $3;                                                }
101                        |  DESTROY SP destroy_instruction             { $$ = $3;                                        }                        |  DESTROY SP destroy_instruction        { $$ = $3;                                                }
102                        |  LIST SP list_instruction                   { $$ = $3;                                        }                        |  LIST SP list_instruction              { $$ = $3;                                                }
103                        |  LOAD SP load_instruction                   { $$ = $3;                                        }                        |  LOAD SP load_instruction              { $$ = $3;                                                }
104                        |  REMOVE SP CHANNEL SP sampler_channel       { $$ = LSCPSERVER->RemoveChannel($5);             }                        |  REMOVE SP CHANNEL SP sampler_channel  { $$ = LSCPSERVER->RemoveChannel($5);                     }
105                        |  SET SP set_instruction                     { $$ = $3;                                        }                        |  SET SP set_instruction                { $$ = $3;                                                }
106                        |  SUBSCRIBE SP subscribe_event               { $$ = $3;                                        }                        |  SUBSCRIBE SP subscribe_event          { $$ = $3;                                                }
107                        |  UNSUBSCRIBE SP unsubscribe_event           { $$ = $3;                                        }                        |  UNSUBSCRIBE SP unsubscribe_event      { $$ = $3;                                                }
108                        |  RESET SP CHANNEL SP sampler_channel        { $$ = LSCPSERVER->ResetChannel($5);              }                        |  SELECT SP text                        { $$ = LSCPSERVER->QueryDatabase($3);                     }
109                        |  QUIT                                       { LSCPSERVER->AnswerClient("Bye!\r\n"); return 0; }                        |  RESET SP CHANNEL SP sampler_channel   { $$ = LSCPSERVER->ResetChannel($5);                      }
110                        ;                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }
111                          |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }
112  subscribe_event       :  CHANNELS                                   { $$ = LSCPSERVER->SubscribeNotification(event_channels); }                        ;
113                        |  VOICE_COUNT                                { $$ = LSCPSERVER->SubscribeNotification(event_voice_count); }  
114                        |  STREAM_COUNT                               { $$ = LSCPSERVER->SubscribeNotification(event_stream_count); }  subscribe_event       :  CHANNELS                              { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channels);     }
115                        |  BUFFER_FILL                                { $$ = LSCPSERVER->SubscribeNotification(event_channel_buffer_fill); }                        |  VOICE_COUNT                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_voice_count);  }
116                        |  INFO                                       { $$ = LSCPSERVER->SubscribeNotification(event_channel_info); }                        |  STREAM_COUNT                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_stream_count); }
117                        |  MISCELLANEOUS                              { $$ = LSCPSERVER->SubscribeNotification(event_misc); }                        |  BUFFER_FILL                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_buffer_fill);  }
118                        ;                        |  INFO                                  { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_info);         }
119                          |  MISCELLANEOUS                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_misc);         }
120  unsubscribe_event     :  CHANNELS                                   { $$ = LSCPSERVER->UnsubscribeNotification(event_channels); }                        ;
121                        |  VOICE_COUNT                                { $$ = LSCPSERVER->UnsubscribeNotification(event_voice_count); }  
122                        |  STREAM_COUNT                               { $$ = LSCPSERVER->UnsubscribeNotification(event_stream_count); }  unsubscribe_event     :  CHANNELS                              { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channels);     }
123                        |  BUFFER_FILL                                { $$ = LSCPSERVER->UnsubscribeNotification(event_channel_buffer_fill); }                        |  VOICE_COUNT                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_voice_count);  }
124                        |  INFO                                       { $$ = LSCPSERVER->UnsubscribeNotification(event_channel_info); }                        |  STREAM_COUNT                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_stream_count); }
125                        |  MISCELLANEOUS                              { $$ = LSCPSERVER->UnsubscribeNotification(event_misc); }                        |  BUFFER_FILL                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_buffer_fill);  }
126                          |  INFO                                  { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_info);         }
127                          |  MISCELLANEOUS                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_misc);         }
128                        ;                        ;
129    
130  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }
131                          |  AVAILABLE_MIDI_INPUT_DRIVERS                                               { $$ = LSCPSERVER->GetAvailableMidiInputDrivers();                 }
132                          |  MIDI_INPUT_DRIVER SP INFO SP string                                        { $$ = LSCPSERVER->GetMidiInputDriverInfo($5);                     }
133                          |  MIDI_INPUT_DRIVER_PARAMETER SP INFO SP string SP string                    { $$ = LSCPSERVER->GetMidiInputDriverParameterInfo($5, $7);        }
134                          |  MIDI_INPUT_DRIVER_PARAMETER SP INFO SP string SP string SP key_val_list    { $$ = LSCPSERVER->GetMidiInputDriverParameterInfo($5, $7, $9);    }
135                        |  AVAILABLE_AUDIO_OUTPUT_DRIVERS                                             { $$ = LSCPSERVER->GetAvailableAudioOutputDrivers();               }                        |  AVAILABLE_AUDIO_OUTPUT_DRIVERS                                             { $$ = LSCPSERVER->GetAvailableAudioOutputDrivers();               }
136                        |  AUDIO_OUTPUT_DRIVER SP INFO SP string                                      { $$ = LSCPSERVER->GetAudioOutputDriverInfo($5);                   }                        |  AUDIO_OUTPUT_DRIVER SP INFO SP string                                      { $$ = LSCPSERVER->GetAudioOutputDriverInfo($5);                   }
137                        |  AUDIO_OUTPUT_DRIVER_PARAMETER SP INFO SP string SP string                  { $$ = LSCPSERVER->GetAudioOutputDriverParameterInfo($5, $7);      }                        |  AUDIO_OUTPUT_DRIVER_PARAMETER SP INFO SP string SP string                  { $$ = LSCPSERVER->GetAudioOutputDriverParameterInfo($5, $7);      }
138                        |  AUDIO_OUTPUT_DRIVER_PARAMETER SP INFO SP string SP string SP key_val_list  { $$ = LSCPSERVER->GetAudioOutputDriverParameterInfo($5, $7, $9);  }                        |  AUDIO_OUTPUT_DRIVER_PARAMETER SP INFO SP string SP string SP key_val_list  { $$ = LSCPSERVER->GetAudioOutputDriverParameterInfo($5, $7, $9);  }
139                        |  AUDIO_OUTPUT_DEVICES                                                       { $$ = LSCPSERVER->GetAudioOutputDeviceCount();                    }                        |  AUDIO_OUTPUT_DEVICES                                                       { $$ = LSCPSERVER->GetAudioOutputDeviceCount();                    }
140                        |  AUDIO_OUTPUT_DEVICE SP INFO SP NUMBER                                      { $$ = LSCPSERVER->GetAudioOutputDeviceInfo($5);                   }                        |  MIDI_INPUT_DEVICES                                                         { $$ = LSCPSERVER->GetMidiInputDeviceCount();                      }
141                        |  AUDIO_OUTPUT_CHANNEL SP INFO SP NUMBER SP NUMBER                           { $$ = LSCPSERVER->GetAudioOutputChannelInfo($5, $7);              }                        |  AUDIO_OUTPUT_DEVICE SP INFO SP number                                      { $$ = LSCPSERVER->GetAudioOutputDeviceInfo($5);                   }
142                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP INFO SP NUMBER SP NUMBER SP string       { $$ = LSCPSERVER->GetAudioOutputChannelParameterInfo($5, $7, $9); }                        |  MIDI_INPUT_DEVICE SP INFO SP number                                        { $$ = LSCPSERVER->GetMidiInputDeviceInfo($5);                     }
143                          |  MIDI_INPUT_PORT SP INFO SP number SP number                                { $$ = LSCPSERVER->GetMidiInputPortInfo($5, $7);                   }
144                          |  MIDI_INPUT_PORT_PARAMETER SP INFO SP number SP number SP string            { $$ = LSCPSERVER->GetMidiInputPortParameterInfo($5, $7, $9);      }
145                          |  AUDIO_OUTPUT_CHANNEL SP INFO SP number SP number                           { $$ = LSCPSERVER->GetAudioOutputChannelInfo($5, $7);              }
146                          |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP INFO SP number SP number SP string       { $$ = LSCPSERVER->GetAudioOutputChannelParameterInfo($5, $7, $9); }
147                        |  CHANNELS                                                                   { $$ = LSCPSERVER->GetChannels();                                  }                        |  CHANNELS                                                                   { $$ = LSCPSERVER->GetChannels();                                  }
148                        |  CHANNEL SP INFO SP sampler_channel                                         { $$ = LSCPSERVER->GetChannelInfo($5);                             }                        |  CHANNEL SP INFO SP sampler_channel                                         { $$ = LSCPSERVER->GetChannelInfo($5);                             }
149                        |  CHANNEL SP BUFFER_FILL SP buffer_size_type SP sampler_channel              { $$ = LSCPSERVER->GetBufferFill($5, $7);                          }                        |  CHANNEL SP BUFFER_FILL SP buffer_size_type SP sampler_channel              { $$ = LSCPSERVER->GetBufferFill($5, $7);                          }
# Line 139  get_instruction       :  AVAILABLE_ENGIN Line 152  get_instruction       :  AVAILABLE_ENGIN
152                        |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }                        |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }
153                        ;                        ;
154    
155  set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP NUMBER SP string EQ param_val             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }  set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP number SP string '=' param_val             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }
156                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP NUMBER SP NUMBER SP string EQ param_val  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP number SP number SP string '=' param_val  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }
157                        |  CHANNEL SP set_chan_instruction                                                   { $$ = $3;                                                         }                        |  MIDI_INPUT_DEVICE_PARAMETER SP number SP string '=' param_val               { $$ = LSCPSERVER->SetMidiInputDeviceParameter($3, $5, $7);        }
158                          |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' param_val       { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, $9);      }
159                          |  CHANNEL SP set_chan_instruction                                             { $$ = $3;                                                         }
160                          |  ECHO SP boolean                                                             { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }
161                          ;
162    
163    create_instruction    :  AUDIO_OUTPUT_DEVICE SP string SP key_val_list  { $$ = LSCPSERVER->CreateAudioOutputDevice($3,$5); }
164                          |  AUDIO_OUTPUT_DEVICE SP string                  { $$ = LSCPSERVER->CreateAudioOutputDevice($3);    }
165                          |  MIDI_INPUT_DEVICE SP string SP key_val_list    { $$ = LSCPSERVER->CreateMidiInputDevice($3,$5);   }
166                          |  MIDI_INPUT_DEVICE SP string                    { $$ = LSCPSERVER->CreateMidiInputDevice($3);      }
167                        ;                        ;
168    
169  create_instruction    :  AUDIO_OUTPUT_DEVICE SP string SP key_val_list { $$ = LSCPSERVER->CreateAudioOutputDevice($3,$5); }  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }
170                        |  AUDIO_OUTPUT_DEVICE SP string                 { $$ = LSCPSERVER->CreateAudioOutputDevice($3); }                        |  MIDI_INPUT_DEVICE SP number    { $$ = LSCPSERVER->DestroyMidiInputDevice($3);   }
                       ;  
   
 destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP NUMBER  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }  
171                        ;                        ;
172    
173  load_instruction      :  INSTRUMENT SP load_instr_args  { $$ = $3; }  load_instruction      :  INSTRUMENT SP load_instr_args  { $$ = $3; }
174                        |  ENGINE SP load_engine_args     { $$ = $3; }                        |  ENGINE SP load_engine_args     { $$ = $3; }
175                        ;                        ;
176    
177  set_chan_instruction  :  AUDIO_OUTPUT_DEVICE SP sampler_channel SP NUMBER                                         { $$ = LSCPSERVER->SetAudioOutputDevice($5, $3);      }  set_chan_instruction  :  AUDIO_OUTPUT_DEVICE SP sampler_channel SP device_index                                              { $$ = LSCPSERVER->SetAudioOutputDevice($5, $3);      }
178                        |  AUDIO_OUTPUT_CHANNEL SP sampler_channel SP audio_output_channel SP audio_output_channel  { $$ = LSCPSERVER->SetAudioOutputChannel($5, $7, $3); }                        |  AUDIO_OUTPUT_CHANNEL SP sampler_channel SP audio_channel_index SP audio_channel_index               { $$ = LSCPSERVER->SetAudioOutputChannel($5, $7, $3); }
179                        |  AUDIO_OUTPUT_TYPE SP sampler_channel SP audio_output_type                                { $$ = LSCPSERVER->SetAudioOutputType($5, $3);        }                        |  AUDIO_OUTPUT_TYPE SP sampler_channel SP audio_output_type_name                                      { $$ = LSCPSERVER->SetAudioOutputType($5, $3);        }
180                        |  MIDI_INPUT_PORT SP sampler_channel SP midi_input_port                                    { $$ = LSCPSERVER->SetMIDIInputPort($5, $3);          }                        |  MIDI_INPUT SP sampler_channel SP device_index SP midi_input_port_index SP midi_input_channel_index  { $$ = LSCPSERVER->SetMIDIInput($5, $7, $9, $3);      }
181                        |  MIDI_INPUT_CHANNEL SP sampler_channel SP midi_input_channel                              { $$ = LSCPSERVER->SetMIDIInputChannel($5, $3);       }                        |  MIDI_INPUT_DEVICE SP sampler_channel SP device_index                                                { $$ = LSCPSERVER->SetMIDIInputDevice($5, $3);        }
182                        |  MIDI_INPUT_TYPE SP sampler_channel SP midi_input_type                                    { $$ = LSCPSERVER->SetMIDIInputType($5, $3);          }                        |  MIDI_INPUT_PORT SP sampler_channel SP midi_input_port_index                                         { $$ = LSCPSERVER->SetMIDIInputPort($5, $3);          }
183                        |  VOLUME SP sampler_channel SP volume                                                      { $$ = LSCPSERVER->SetVolume($5, $3);                 }                        |  MIDI_INPUT_CHANNEL SP sampler_channel SP midi_input_channel_index                                   { $$ = LSCPSERVER->SetMIDIInputChannel($5, $3);       }
184                          |  MIDI_INPUT_TYPE SP sampler_channel SP midi_input_type_name                                          { $$ = LSCPSERVER->SetMIDIInputType($5, $3);          }
185                          |  VOLUME SP sampler_channel SP volume_value                                                           { $$ = LSCPSERVER->SetVolume($5, $3);                 }
186                        ;                        ;
187    
188  key_val_list          :  string EQ param_val                  { $$[$1] = $3;          }  key_val_list          :  string '=' param_val                  { $$[$1] = $3;          }
189                        |  key_val_list SP string EQ param_val  { $$ = $1; $$[$3] = $5; }                        |  key_val_list SP string '=' param_val  { $$ = $1; $$[$3] = $5; }
190                        ;                        ;
191    
192  buffer_size_type      :  BYTES       { $$ = fill_response_bytes;      }  buffer_size_type      :  BYTES       { $$ = fill_response_bytes;      }
# Line 173  buffer_size_type      :  BYTES       { $ Line 194  buffer_size_type      :  BYTES       { $
194                        ;                        ;
195    
196  list_instruction      :  AUDIO_OUTPUT_DEVICES  { $$ = LSCPSERVER->GetAudioOutputDevices(); }  list_instruction      :  AUDIO_OUTPUT_DEVICES  { $$ = LSCPSERVER->GetAudioOutputDevices(); }
197                          |  MIDI_INPUT_DEVICES    { $$ = LSCPSERVER->GetMidiInputDevices();   }
198                          |  CHANNELS              { $$ = LSCPSERVER->ListChannels();          }
199                        ;                        ;
200    
201  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);       }
202                        |  NON_MODAL SP filename SP instrument_index SP sampler_channel  { $$ = LSCPSERVER->LoadInstrument($3, $5, $7, true); }                        |  NON_MODAL SP filename SP instrument_index SP sampler_channel  { $$ = LSCPSERVER->LoadInstrument($3, $5, $7, true); }
203                        ;                        ;
204    
205  load_engine_args      :  engine_name SP sampler_channel  { $$ = LSCPSERVER->LoadEngine($1, $3); }  load_engine_args      :  engine_name SP sampler_channel  { $$ = LSCPSERVER->SetEngineType($1, $3); }
206                        ;                        ;
207    
208  audio_output_type     :  string  device_index              :  number
209                              ;
210    
211    audio_channel_index       :  number
212                              ;
213    
214    audio_output_type_name    :  string
215                              ;
216    
217    midi_input_port_index     :  number
218                              ;
219    
220    midi_input_channel_index  :  number
221                              |  ALL  { $$ = 16; }
222                              ;
223    
224    midi_input_type_name      :  string
225                              ;
226    
227    volume_value              :  dotnum
228                              |  number  { $$ = $1; }
229                              ;
230    
231    sampler_channel           :  number
232                              ;
233    
234    instrument_index          :  number
235                              ;
236    
237    engine_name               :  string
238                              ;
239    
240    filename                  :  stringval
241                              ;
242    
243    param_val                 :  string
244                              |  stringval
245                              |  number     { std::stringstream ss; ss << $1; $$ = ss.str(); }
246                              |  dotnum     { std::stringstream ss; ss << $1; $$ = ss.str(); }
247                              ;
248    
249    
250    // atomic variable symbol rules
251    
252    boolean               :  number  { $$ = $1; }
253                          |  string  { $$ = -1; }
254                          ;
255    
256    string                :  char          { std::string s; s = $1; $$ = s; }
257                          |  string char   { $$ = $1 + $2;                  }
258                          ;
259    
260    dotnum                :      digits '.' digits  { $$ = atof(String($1 + "." + $3).c_str());                         }
261                          |  '+' digits '.' digits  { String s = "+"; s += $2; s += "."; s += $4; $$ = atof(s.c_str()); }
262                          |  '-' digits '.' digits  { $$ = atof(String("-" + $2 + "." + $4).c_str());                   }
263                          ;
264    
265    
266    digits                :  digit         { $$ = $1;      }
267                          |  digits digit  { $$ = $1 + $2; }
268                          ;
269    
270    digit                 :  '0'  { $$ = '0'; }
271                          |  '1'  { $$ = '1'; }
272                          |  '2'  { $$ = '2'; }
273                          |  '3'  { $$ = '3'; }
274                          |  '4'  { $$ = '4'; }
275                          |  '5'  { $$ = '5'; }
276                          |  '6'  { $$ = '6'; }
277                          |  '7'  { $$ = '7'; }
278                          |  '8'  { $$ = '8'; }
279                          |  '9'  { $$ = '9'; }
280                          ;
281    
282    number                :  digit       { $$ = atoi(String(1, $1).c_str());      }
283                          |  '1' digits  { $$ = atoi(String(String("1") + $2).c_str()); }
284                          |  '2' digits  { $$ = atoi(String(String("2") + $2).c_str()); }
285                          |  '3' digits  { $$ = atoi(String(String("3") + $2).c_str()); }
286                          |  '4' digits  { $$ = atoi(String(String("4") + $2).c_str()); }
287                          |  '5' digits  { $$ = atoi(String(String("5") + $2).c_str()); }
288                          |  '6' digits  { $$ = atoi(String(String("6") + $2).c_str()); }
289                          |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }
290                          |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }
291                          |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }
292    
293    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'; }
294                          |  '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'; }
295                          |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }
296                          |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; } | '/' { $$ = '/'; }
297                          |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }
298                          |  '[' { $$ = '['; } | '\\' { $$ = '\\'; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }
299                          |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }
300                          |  '\200' { $$ = '\200'; } | '\201' { $$ = '\201'; } | '\202' { $$ = '\202'; }
301                          |  '\203' { $$ = '\203'; } | '\204' { $$ = '\204'; } | '\205' { $$ = '\205'; }
302                          |  '\206' { $$ = '\206'; } | '\207' { $$ = '\207'; } | '\210' { $$ = '\210'; }
303                          |  '\211' { $$ = '\211'; } | '\212' { $$ = '\212'; } | '\213' { $$ = '\213'; }
304                          |  '\214' { $$ = '\214'; } | '\215' { $$ = '\215'; } | '\216' { $$ = '\216'; }
305                          |  '\217' { $$ = '\217'; } | '\220' { $$ = '\220'; } | '\221' { $$ = '\221'; }
306                          |  '\222' { $$ = '\222'; } | '\223' { $$ = '\223'; } | '\224' { $$ = '\224'; }
307                          |  '\225' { $$ = '\225'; } | '\226' { $$ = '\226'; } | '\227' { $$ = '\227'; }
308                          |  '\230' { $$ = '\230'; } | '\231' { $$ = '\231'; } | '\232' { $$ = '\232'; }
309                          |  '\233' { $$ = '\233'; } | '\234' { $$ = '\234'; } | '\235' { $$ = '\235'; }
310                          |  '\236' { $$ = '\236'; } | '\237' { $$ = '\237'; } | '\240' { $$ = '\240'; }
311                          |  '\241' { $$ = '\241'; } | '\242' { $$ = '\242'; } | '\243' { $$ = '\243'; }
312                          |  '\244' { $$ = '\244'; } | '\245' { $$ = '\245'; } | '\246' { $$ = '\246'; }
313                          |  '\247' { $$ = '\247'; } | '\250' { $$ = '\250'; } | '\251' { $$ = '\251'; }
314                          |  '\252' { $$ = '\252'; } | '\253' { $$ = '\253'; } | '\254' { $$ = '\254'; }
315                          |  '\255' { $$ = '\255'; } | '\256' { $$ = '\256'; } | '\257' { $$ = '\257'; }
316                          |  '\260' { $$ = '\260'; } | '\261' { $$ = '\261'; } | '\262' { $$ = '\262'; }
317                          |  '\263' { $$ = '\263'; } | '\264' { $$ = '\264'; } | '\265' { $$ = '\265'; }
318                          |  '\266' { $$ = '\266'; } | '\267' { $$ = '\267'; } | '\270' { $$ = '\270'; }
319                          |  '\271' { $$ = '\271'; } | '\272' { $$ = '\272'; } | '\273' { $$ = '\273'; }
320                          |  '\274' { $$ = '\274'; } | '\275' { $$ = '\275'; } | '\276' { $$ = '\276'; }
321                          |  '\277' { $$ = '\277'; } | '\300' { $$ = '\300'; } | '\301' { $$ = '\301'; }
322                          |  '\302' { $$ = '\302'; } | '\303' { $$ = '\303'; } | '\304' { $$ = '\304'; }
323                          |  '\305' { $$ = '\305'; } | '\306' { $$ = '\306'; } | '\307' { $$ = '\307'; }
324                          |  '\310' { $$ = '\310'; } | '\311' { $$ = '\311'; } | '\312' { $$ = '\312'; }
325                          |  '\313' { $$ = '\313'; } | '\314' { $$ = '\314'; } | '\315' { $$ = '\315'; }
326                          |  '\316' { $$ = '\316'; } | '\317' { $$ = '\317'; } | '\320' { $$ = '\320'; }
327                          |  '\321' { $$ = '\321'; } | '\322' { $$ = '\322'; } | '\323' { $$ = '\323'; }
328                          |  '\324' { $$ = '\324'; } | '\325' { $$ = '\325'; } | '\326' { $$ = '\326'; }
329                          |  '\327' { $$ = '\327'; } | '\330' { $$ = '\330'; } | '\331' { $$ = '\331'; }
330                          |  '\332' { $$ = '\332'; } | '\333' { $$ = '\333'; } | '\334' { $$ = '\334'; }
331                          |  '\335' { $$ = '\335'; } | '\336' { $$ = '\336'; } | '\337' { $$ = '\337'; }
332                          |  '\340' { $$ = '\340'; } | '\341' { $$ = '\341'; } | '\342' { $$ = '\342'; }
333                          |  '\343' { $$ = '\343'; } | '\344' { $$ = '\344'; } | '\345' { $$ = '\345'; }
334                          |  '\346' { $$ = '\346'; } | '\347' { $$ = '\347'; } | '\350' { $$ = '\350'; }
335                          |  '\351' { $$ = '\351'; } | '\352' { $$ = '\352'; } | '\353' { $$ = '\353'; }
336                          |  '\354' { $$ = '\354'; } | '\355' { $$ = '\355'; } | '\356' { $$ = '\356'; }
337                          |  '\357' { $$ = '\357'; } | '\360' { $$ = '\360'; } | '\361' { $$ = '\361'; }
338                          |  '\362' { $$ = '\362'; } | '\363' { $$ = '\363'; } | '\364' { $$ = '\364'; }
339                          |  '\365' { $$ = '\365'; } | '\366' { $$ = '\366'; } | '\367' { $$ = '\367'; }
340                          |  '\370' { $$ = '\370'; } | '\371' { $$ = '\371'; } | '\372' { $$ = '\372'; }
341                          |  '\373' { $$ = '\373'; } | '\374' { $$ = '\374'; } | '\375' { $$ = '\375'; }
342                          |  '\376' { $$ = '\376'; } | '\377' { $$ = '\377'; }
343                        ;                        ;
344    
345  midi_input_type       :  string  text                  :  SP           { $$ = " ";      }
346                          |  string
347                          |  text SP      { $$ = $1 + " "; }
348                          |  text string  { $$ = $1 + $2;  }
349                        ;                        ;
350    
351  volume                :  DOTNUM  stringval             :  '\'' text '\''  { $$ = $2; }
352                        |  NUMBER  { $$ = $1; }                        |  '\"' text '\"'  { $$ = $2; }
353                        ;                        ;
354    
355  sampler_channel       :  NUMBER  
356    // rules which are more or less just terminal symbols
357    
358    SP                    :  ' '
359                        ;                        ;
360    
361  instrument_index      :  NUMBER  LF                    :  '\n'
362                        ;                        ;
363    
364  audio_output_channel  :  NUMBER  CR                    :  '\r'
365                        ;                        ;
366    
367  midi_input_channel    :  NUMBER  ADD                   :  'A''D''D'
368                        ;                        ;
369    
370  engine_name           :  string  GET                   :  'G''E''T'
371                        ;                        ;
372    
373  midi_input_port       :  STRINGVAL  CREATE                :  'C''R''E''A''T''E'
374                        ;                        ;
375    
376  filename              :  STRINGVAL  DESTROY               :  'D''E''S''T''R''O''Y'
377                        |  string                        ;
378    
379    LIST                  :  'L''I''S''T'
380                          ;
381    
382    LOAD                  :  'L''O''A''D'
383                          ;
384    
385    ALL                   :  'A''L''L'
386                          ;
387    
388    NON_MODAL             :  'N''O''N''_''M''O''D''A''L'
389                          ;
390    
391    REMOVE                :  'R''E''M''O''V''E'
392                          ;
393    
394    SET                   :  'S''E''T'
395                          ;
396    
397    SUBSCRIBE             :  'S''U''B''S''C''R''I''B''E'
398                          ;
399    
400    UNSUBSCRIBE           :  'U''N''S''U''B''S''C''R''I''B''E'
401                          ;
402    
403    SELECT                :  'S''E''L''E''C''T'
404                          ;
405    
406    CHANNEL               :  'C''H''A''N''N''E''L'
407                          ;
408    
409    AVAILABLE_ENGINES     :  'A''V''A''I''L''A''B''L''E''_''E''N''G''I''N''E''S'
410                          ;
411    
412    AVAILABLE_AUDIO_OUTPUT_DRIVERS  :  'A''V''A''I''L''A''B''L''E''_''A''U''D''I''O''_''O''U''T''P''U''T''_''D''R''I''V''E''R''S'
413                                    ;
414    
415    CHANNELS             :  'C''H''A''N''N''E''L''S'
416                         ;
417    
418    INFO                 :  'I''N''F''O'
419                         ;
420    
421    BUFFER_FILL          :  'B''U''F''F''E''R''_''F''I''L''L'
422                         ;
423    
424    STREAM_COUNT         :  'S''T''R''E''A''M''_''C''O''U''N''T'
425                         ;
426    
427    VOICE_COUNT          :  'V''O''I''C''E''_''C''O''U''N''T'
428                         ;
429    
430    INSTRUMENT           :  'I''N''S''T''R''U''M''E''N''T'
431                         ;
432    
433    ENGINE               :  'E' 'N' 'G' 'I' 'N' 'E'
434                         ;
435    
436    AUDIO_OUTPUT_DEVICE_PARAMETER  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E''_''P''A''R''A''M''E''T''E''R'
437                                   ;
438    
439    AUDIO_OUTPUT_DEVICES  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E''S'
440                          ;
441    
442    AUDIO_OUTPUT_DEVICE   :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E'
443                          ;
444    
445    AUDIO_OUTPUT_DRIVER_PARAMETER  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''R''I''V''E''R''_''P''A''R''A''M''E''T''E''R'
446                                   ;
447    
448    AUDIO_OUTPUT_DRIVER   :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''R''I''V''E''R'
449                          ;
450    
451    AUDIO_OUTPUT_CHANNEL_PARAMETER  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''C''H''A''N''N''E''L''_''P''A''R''A''M''E''T''E''R'
452                                    ;
453    
454    AUDIO_OUTPUT_CHANNEL  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''C''H''A''N''N''E''L'
455                          ;
456    
457    AUDIO_OUTPUT_TYPE     :  'A''U''D''I''O''_''O''U''T''P''U''T''_''T''Y''P''E'
458                          ;
459    
460    AVAILABLE_MIDI_INPUT_DRIVERS  :  'A''V''A''I''L''A''B''L''E''_''M''I''D''I''_''I''N''P''U''T''_''D''R''I''V''E''R''S'
461                                  ;
462    
463    MIDI_INPUT_DEVICE_PARAMETER  :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E''_''P''A''R''A''M''E''T''E''R'
464                                 ;
465    
466    MIDI_INPUT_PORT_PARAMETER    :  'M''I''D''I''_''I''N''P''U''T''_''P''O''R''T''_''P''A''R''A''M''E''T''E''R'
467                                 ;
468    
469    MIDI_INPUT_DEVICES   :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E''S'
470                         ;
471    
472    MIDI_INPUT_DEVICE     :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E'
473                          ;
474    
475    MIDI_INPUT_DRIVER_PARAMETER  :  'M''I''D''I''_''I''N''P''U''T''_''D''R''I''V''E''R''_''P''A''R''A''M''E''T''E''R'
476                                 ;
477    
478    MIDI_INPUT_DRIVER     :  'M''I''D''I''_''I''N''P''U''T''_''D''R''I''V''E''R'
479                          ;
480    
481    MIDI_INPUT_PORT       :  'M''I''D''I''_''I''N''P''U''T''_''P''O''R''T'
482                          ;
483    
484    MIDI_INPUT_CHANNEL    :  'M''I''D''I''_''I''N''P''U''T''_''C''H''A''N''N''E''L'
485                          ;
486    
487    MIDI_INPUT_TYPE       :  'M''I''D''I''_''I''N''P''U''T''_''T''Y''P''E'
488                          ;
489    
490    MIDI_INPUT            :  'M''I''D''I''_''I''N''P''U''T'
491                          ;
492    
493    VOLUME                :  'V''O''L''U''M''E'
494                          ;
495    
496    BYTES                 :  'B''Y''T''E''S'
497                          ;
498    
499    PERCENTAGE            :  'P''E''R''C''E''N''T''A''G''E'
500                          ;
501    
502    RESET                 :  'R''E''S''E''T'
503                          ;
504    
505    MISCELLANEOUS         :  'M''I''S''C''E''L''L''A''N''E''O''U''S'
506                        ;                        ;
507    
508  param_val             :  STRINGVAL                { $$ = $1;                                             }  ECHO                  :  'E''C''H''O'
                       |  NUMBER                   { std::stringstream ss; ss << $1; $$ = ss.str();       }  
                       |  DOTNUM                   { std::stringstream ss; ss << $1; $$ = ss.str();       }  
509                        ;                        ;
510    
511  string                :  CHAR          { std::string s; s = $1; $$ = s; }  QUIT                  :  'Q''U''I''T'
                       |  string CHAR   { $$ = $1 + $2;                  }  
512                        ;                        ;
513    
514  %%  %%
# Line 233  void yyerror(const char* s) { Line 521  void yyerror(const char* s) {
521  }  }
522    
523  /**  /**
524   * Clears input buffer and restarts scanner.   * Clears input buffer.
525   */   */
526  void restart(yyparse_param_t* pparam, int& yychar) {  void restart(yyparse_param_t* pparam, int& yychar) {
527      // restart scanner      bytes = 0;
528      yyrestart(stdin, pparam->pScanner);      ptr   = 0;
     // flush input buffer  
     static char buf[1024];  
     while(recv(hSession, buf, 1024, MSG_DONTWAIT) > 0);  
     // reset lookahead symbol  
     yyclearin;  
529  }  }

Legend:
Removed from v.143  
changed lines
  Added in v.411

  ViewVC Help
Powered by ViewVC