/[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 1481 - (show annotations) (download) (as text)
Wed Nov 14 23:42:15 2007 UTC (16 years, 5 months ago) by senoner
File MIME type: text/x-c++hdr
File size: 4277 byte(s)
* win32 port work in progress:
* - implemented win32 support in the following classes:
* Thread, Condition, Mutex, Path, LscpServer
* - lscp.y use DONTCARE instead of VOID
*  (a win32 symbol defined)
* - completed win32 editor plugin loader

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

  ViewVC Help
Powered by ViewVC