/[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 219 - (hide annotations) (download) (as text)
Tue Aug 17 20:35:04 2004 UTC (19 years, 8 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3652 byte(s)
* completely removed the lex scanner and replaced it by pure yacc rules
  for all terminal symbols (that is command keywords and variables) to
  avoid misunderstandings while parsing (e.g. recognition of command
  keywords in string arguments)
* src/drivers/audio/AudioChannel.cpp: changed channel parameter 'Name' to
 'NAME' as defined in the LSCP documentation

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 219 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     /**
79     * Parameters given to the parser on every yyparse() call.
80     */
81     struct yyparse_param_t {
82     LSCPServer* pServer;
83 schoenebeck 210 int hSession;
84     bool bVerbose; ///< if true then all commands will immediately sent back (echo)
85    
86     yyparse_param_t() {
87     pServer = NULL;
88     hSession = -1;
89     bVerbose = false;
90     }
91 schoenebeck 35 };
92     #define YYPARSE_PARAM yyparse_param
93    
94     /**
95     * Prototype of the main scanner function (lexical analyzer).
96     */
97 schoenebeck 219 #define YY_DECL int yylex(YYSTYPE* yylval)
98 schoenebeck 35
99     #endif // __LSCPPARSER_H__

  ViewVC Help
Powered by ViewVC