/[svn]/linuxsampler/trunk/src/network/lscpparser.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/network/lscpparser.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 170 - (show annotations) (download) (as text)
Sat Jul 3 20:08:07 2004 UTC (19 years, 9 months ago) by senkov
File MIME type: text/x-c++hdr
File size: 3795 byte(s)
* moved ToString to common
* Implemented handling of multiple connections
* Implemented guts for event subscription/unsubscription
* Illustrated event notification sending by sending MISC events
when connections are established or terminated.

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #ifndef __LSCPPARSER_H__
24 #define __LSCPPARSER_H__
25
26 #include <sys/types.h>
27 #include <sys/socket.h>
28
29 #include <stdlib.h>
30 #include <iostream>
31 #include <sstream>
32 #include <string>
33
34 #include "../common/global.h"
35 #include "lscpevent.h"
36 #include "../Sampler.h"
37
38 /// Will be returned by the parser in case of syntax errors.
39 #define LSCP_SYNTAX_ERROR -69
40 #define LSCP_QUIT -1
41 #define LSCP_DONE 0
42
43 using namespace LinuxSampler;
44
45 // just symbol prototyping
46 class LSCPServer;
47
48 /**
49 * How the fill states of disk stream buffers should be reflected.
50 */
51 enum fill_response_t {
52 fill_response_bytes, ///< The returned values are meant in bytes.
53 fill_response_percentage ///< The returned values are meant in percentage.
54 };
55
56 /**
57 * Semantic value of the lookahead symbol.
58 *
59 * Structure that is used by the parser to process and return values from the
60 * input text. The lexical analyzer for example returns a number for
61 * recognized number strings in the input text and the parser might return a
62 * value for each of it's rules.
63 */
64 struct YYSTYPE {
65 union {
66 char Char;
67 unsigned int Number;
68 double Dotnum;
69 fill_response_t FillResponse;
70 LSCPEvent::event_t Event;
71 };
72 std::string String;
73 std::map<std::string,std::string> KeyValList;
74 };
75 #define yystype YYSTYPE ///< For backward compatibility.
76 #define YYSTYPE_IS_DECLARED ///< We tell the lexer / parser that we use our own data structure as defined above.
77
78 // pointer to an (reentrant) scanner / lexical analyzer
79 typedef void* yyscan_t;
80
81 /**
82 * Parameters given to the parser on every yyparse() call.
83 */
84 struct yyparse_param_t {
85 LSCPServer* pServer;
86 yyscan_t pScanner;
87 };
88 #define YYPARSE_PARAM yyparse_param
89
90 /**
91 * Prototype of the main scanner function (lexical analyzer).
92 */
93 #define YY_DECL int yylex(YYSTYPE* yylval, yyscan_t yyscanner)
94
95 /**
96 * Override lex's input function which just reads from stdin by default.
97 * We read from a socket instead.
98 */
99 extern int GetLSCPCommand( void *buf, int max_size);
100 #define YY_INPUT(buf,result,max_size) \
101 result = GetLSCPCommand(buf, max_size)
102
103 #endif // __LSCPPARSER_H__

  ViewVC Help
Powered by ViewVC