1 |
schoenebeck |
35 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
|
|
* LinuxSampler - modular, streaming capable sampler * |
4 |
|
|
* * |
5 |
schoenebeck |
56 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
schoenebeck |
1047 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
schoenebeck |
35 |
* * |
8 |
|
|
* 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 * |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
11 |
|
|
* (at your option) any later version. * |
12 |
|
|
* * |
13 |
|
|
* This program is distributed in the hope that it will be useful, * |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
16 |
|
|
* GNU General Public License for more details. * |
17 |
|
|
* * |
18 |
|
|
* You should have received a copy of the GNU General Public License * |
19 |
|
|
* along with this program; if not, write to the Free Software * |
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
21 |
|
|
* MA 02111-1307 USA * |
22 |
|
|
***************************************************************************/ |
23 |
|
|
|
24 |
|
|
#ifndef __LSCPPARSER_H__ |
25 |
|
|
#define __LSCPPARSER_H__ |
26 |
|
|
|
27 |
|
|
#include <sys/types.h> |
28 |
|
|
#include <sys/socket.h> |
29 |
|
|
|
30 |
|
|
#include <stdlib.h> |
31 |
|
|
#include <iostream> |
32 |
|
|
#include <sstream> |
33 |
|
|
#include <string> |
34 |
|
|
|
35 |
schoenebeck |
1424 |
#include "../common/global_private.h" |
36 |
schoenebeck |
1332 |
#include "../common/Path.h" |
37 |
senkov |
170 |
#include "lscpevent.h" |
38 |
schoenebeck |
53 |
#include "../Sampler.h" |
39 |
schoenebeck |
947 |
#include "../drivers/midi/MidiInstrumentMapper.h" |
40 |
schoenebeck |
35 |
|
41 |
|
|
/// Will be returned by the parser in case of syntax errors. |
42 |
|
|
#define LSCP_SYNTAX_ERROR -69 |
43 |
senkov |
170 |
#define LSCP_QUIT -1 |
44 |
|
|
#define LSCP_DONE 0 |
45 |
schoenebeck |
35 |
|
46 |
schoenebeck |
53 |
using namespace LinuxSampler; |
47 |
|
|
|
48 |
senkov |
170 |
// just symbol prototyping |
49 |
|
|
class LSCPServer; |
50 |
|
|
|
51 |
schoenebeck |
35 |
/** |
52 |
|
|
* How the fill states of disk stream buffers should be reflected. |
53 |
|
|
*/ |
54 |
|
|
enum fill_response_t { |
55 |
|
|
fill_response_bytes, ///< The returned values are meant in bytes. |
56 |
|
|
fill_response_percentage ///< The returned values are meant in percentage. |
57 |
|
|
}; |
58 |
|
|
|
59 |
|
|
/** |
60 |
|
|
* Semantic value of the lookahead symbol. |
61 |
|
|
* |
62 |
|
|
* Structure that is used by the parser to process and return values from the |
63 |
|
|
* input text. The lexical analyzer for example returns a number for |
64 |
|
|
* recognized number strings in the input text and the parser might return a |
65 |
|
|
* value for each of it's rules. |
66 |
|
|
*/ |
67 |
schoenebeck |
1244 |
struct _YYSTYPE { |
68 |
schoenebeck |
35 |
union { |
69 |
schoenebeck |
947 |
char Char; |
70 |
|
|
unsigned int Number; |
71 |
schoenebeck |
1047 |
bool Bool; |
72 |
schoenebeck |
947 |
double Dotnum; |
73 |
|
|
fill_response_t FillResponse; |
74 |
|
|
LSCPEvent::event_t Event; |
75 |
|
|
MidiInstrumentMapper::mode_t LoadMode; |
76 |
schoenebeck |
35 |
}; |
77 |
schoenebeck |
123 |
std::string String; |
78 |
|
|
std::map<std::string,std::string> KeyValList; |
79 |
schoenebeck |
1332 |
Path UniversalPath; |
80 |
schoenebeck |
35 |
}; |
81 |
schoenebeck |
1244 |
#define YYSTYPE _YYSTYPE |
82 |
schoenebeck |
35 |
#define yystype YYSTYPE ///< For backward compatibility. |
83 |
|
|
#define YYSTYPE_IS_DECLARED ///< We tell the lexer / parser that we use our own data structure as defined above. |
84 |
|
|
|
85 |
|
|
/** |
86 |
|
|
* Parameters given to the parser on every yyparse() call. |
87 |
|
|
*/ |
88 |
|
|
struct yyparse_param_t { |
89 |
|
|
LSCPServer* pServer; |
90 |
schoenebeck |
210 |
int hSession; |
91 |
|
|
bool bVerbose; ///< if true then all commands will immediately sent back (echo) |
92 |
schoenebeck |
1252 |
int iLine; ///< Current line (just for verbosity / messages) |
93 |
|
|
int iColumn; ///< Current column (just for verbosity / messages) |
94 |
schoenebeck |
210 |
|
95 |
|
|
yyparse_param_t() { |
96 |
|
|
pServer = NULL; |
97 |
|
|
hSession = -1; |
98 |
|
|
bVerbose = false; |
99 |
schoenebeck |
1252 |
iLine = iColumn = 0; |
100 |
schoenebeck |
210 |
} |
101 |
schoenebeck |
35 |
}; |
102 |
|
|
#define YYPARSE_PARAM yyparse_param |
103 |
|
|
|
104 |
|
|
/** |
105 |
|
|
* Prototype of the main scanner function (lexical analyzer). |
106 |
|
|
*/ |
107 |
schoenebeck |
219 |
#define YY_DECL int yylex(YYSTYPE* yylval) |
108 |
schoenebeck |
35 |
|
109 |
|
|
#endif // __LSCPPARSER_H__ |