1 |
/*************************************************************************** |
2 |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
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 |
#include "../common/global.h" |
36 |
#include "lscpevent.h" |
37 |
#include "../Sampler.h" |
38 |
#include "../drivers/midi/MidiInstrumentMapper.h" |
39 |
|
40 |
/// Will be returned by the parser in case of syntax errors. |
41 |
#define LSCP_SYNTAX_ERROR -69 |
42 |
#define LSCP_QUIT -1 |
43 |
#define LSCP_DONE 0 |
44 |
|
45 |
using namespace LinuxSampler; |
46 |
|
47 |
// just symbol prototyping |
48 |
class LSCPServer; |
49 |
|
50 |
/** |
51 |
* How the fill states of disk stream buffers should be reflected. |
52 |
*/ |
53 |
enum fill_response_t { |
54 |
fill_response_bytes, ///< The returned values are meant in bytes. |
55 |
fill_response_percentage ///< The returned values are meant in percentage. |
56 |
}; |
57 |
|
58 |
/** |
59 |
* Semantic value of the lookahead symbol. |
60 |
* |
61 |
* Structure that is used by the parser to process and return values from the |
62 |
* input text. The lexical analyzer for example returns a number for |
63 |
* recognized number strings in the input text and the parser might return a |
64 |
* value for each of it's rules. |
65 |
*/ |
66 |
struct _YYSTYPE { |
67 |
union { |
68 |
char Char; |
69 |
unsigned int Number; |
70 |
bool Bool; |
71 |
double Dotnum; |
72 |
fill_response_t FillResponse; |
73 |
LSCPEvent::event_t Event; |
74 |
MidiInstrumentMapper::mode_t LoadMode; |
75 |
}; |
76 |
std::string String; |
77 |
std::map<std::string,std::string> KeyValList; |
78 |
}; |
79 |
#define YYSTYPE _YYSTYPE |
80 |
#define yystype YYSTYPE ///< For backward compatibility. |
81 |
#define YYSTYPE_IS_DECLARED ///< We tell the lexer / parser that we use our own data structure as defined above. |
82 |
|
83 |
/** |
84 |
* Parameters given to the parser on every yyparse() call. |
85 |
*/ |
86 |
struct yyparse_param_t { |
87 |
LSCPServer* pServer; |
88 |
int hSession; |
89 |
bool bVerbose; ///< if true then all commands will immediately sent back (echo) |
90 |
|
91 |
yyparse_param_t() { |
92 |
pServer = NULL; |
93 |
hSession = -1; |
94 |
bVerbose = false; |
95 |
} |
96 |
}; |
97 |
#define YYPARSE_PARAM yyparse_param |
98 |
|
99 |
/** |
100 |
* Prototype of the main scanner function (lexical analyzer). |
101 |
*/ |
102 |
#define YY_DECL int yylex(YYSTYPE* yylval) |
103 |
|
104 |
#endif // __LSCPPARSER_H__ |