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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 210 - (hide annotations) (download) (as text)
Sat Jul 24 12:33:49 2004 UTC (19 years, 9 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4041 byte(s)
* implemented "SET ECHO" LSCP command

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 35 * *
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 schoenebeck 53 #include "../common/global.h"
35 senkov 170 #include "lscpevent.h"
36 schoenebeck 53 #include "../Sampler.h"
37 schoenebeck 35
38     /// Will be returned by the parser in case of syntax errors.
39     #define LSCP_SYNTAX_ERROR -69
40 senkov 170 #define LSCP_QUIT -1
41     #define LSCP_DONE 0
42 schoenebeck 35
43 schoenebeck 53 using namespace LinuxSampler;
44    
45 senkov 170 // just symbol prototyping
46     class LSCPServer;
47    
48 schoenebeck 35 /**
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 schoenebeck 123 char Char;
67     unsigned int Number;
68     double Dotnum;
69     fill_response_t FillResponse;
70 senkov 170 LSCPEvent::event_t Event;
71 schoenebeck 35 };
72 schoenebeck 123 std::string String;
73     std::map<std::string,std::string> KeyValList;
74 schoenebeck 35 };
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 schoenebeck 210 int hSession;
87 schoenebeck 35 yyscan_t pScanner;
88 schoenebeck 210 bool bVerbose; ///< if true then all commands will immediately sent back (echo)
89    
90     yyparse_param_t() {
91     pServer = NULL;
92     hSession = -1;
93     pScanner = NULL;
94     bVerbose = false;
95     }
96 schoenebeck 35 };
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, yyscan_t yyscanner)
103    
104     /**
105     * Override lex's input function which just reads from stdin by default.
106     * We read from a socket instead.
107     */
108 senkov 170 extern int GetLSCPCommand( void *buf, int max_size);
109 schoenebeck 35 #define YY_INPUT(buf,result,max_size) \
110 schoenebeck 210 result = GetLSCPCommand(buf, max_size)
111 schoenebeck 35
112     #endif // __LSCPPARSER_H__

  ViewVC Help
Powered by ViewVC