/[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 2534 - (hide annotations) (download) (as text)
Sun Mar 9 21:34:03 2014 UTC (10 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5475 byte(s)
* LSCP shell (WIP): Added initial support for built-in LSCP reference
  documentation, which will automatically show the relevant LSCP reference
  section on screen as soon as one specific LSCP command was detected while
  typing on the command line.
* Bumped version (1.0.0.svn37).

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 2510 * Copyright (C) 2005 - 2014 Christian Schoenebeck *
7 schoenebeck 35 * *
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 senoner 1481 #if defined(WIN32)
29     #include <windows.h>
30     #else
31 schoenebeck 35 #include <sys/socket.h>
32 senoner 1481 #endif
33 schoenebeck 35
34     #include <stdlib.h>
35     #include <iostream>
36     #include <sstream>
37     #include <string>
38 schoenebeck 2510 #include <stdint.h>
39     #include <set>
40 schoenebeck 35
41 schoenebeck 1424 #include "../common/global_private.h"
42 schoenebeck 1332 #include "../common/Path.h"
43 senkov 170 #include "lscpevent.h"
44 schoenebeck 53 #include "../Sampler.h"
45 schoenebeck 947 #include "../drivers/midi/MidiInstrumentMapper.h"
46 schoenebeck 2534 #include "lscp_shell_reference.h"
47 schoenebeck 35
48 persson 1765 namespace LinuxSampler {
49    
50 schoenebeck 35 /// Will be returned by the parser in case of syntax errors.
51     #define LSCP_SYNTAX_ERROR -69
52 senkov 170 #define LSCP_QUIT -1
53     #define LSCP_DONE 0
54 schoenebeck 35
55 senkov 170 // just symbol prototyping
56     class LSCPServer;
57    
58 schoenebeck 35 /**
59     * How the fill states of disk stream buffers should be reflected.
60     */
61     enum fill_response_t {
62     fill_response_bytes, ///< The returned values are meant in bytes.
63     fill_response_percentage ///< The returned values are meant in percentage.
64     };
65    
66     /**
67     * Semantic value of the lookahead symbol.
68     *
69     * Structure that is used by the parser to process and return values from the
70     * input text. The lexical analyzer for example returns a number for
71     * recognized number strings in the input text and the parser might return a
72     * value for each of it's rules.
73     */
74 schoenebeck 1244 struct _YYSTYPE {
75 schoenebeck 35 union {
76 schoenebeck 947 char Char;
77     unsigned int Number;
78 schoenebeck 1047 bool Bool;
79 schoenebeck 947 double Dotnum;
80     fill_response_t FillResponse;
81     LSCPEvent::event_t Event;
82     MidiInstrumentMapper::mode_t LoadMode;
83 schoenebeck 35 };
84 schoenebeck 123 std::string String;
85     std::map<std::string,std::string> KeyValList;
86 schoenebeck 1332 Path UniversalPath;
87 schoenebeck 35 };
88 schoenebeck 1244 #define YYSTYPE _YYSTYPE
89 schoenebeck 35 #define yystype YYSTYPE ///< For backward compatibility.
90     #define YYSTYPE_IS_DECLARED ///< We tell the lexer / parser that we use our own data structure as defined above.
91 schoenebeck 2510 #define YYTYPE_INT16 int16_t
92 schoenebeck 2516 #define YYDEBUG 1
93 schoenebeck 35
94     /**
95     * Parameters given to the parser on every yyparse() call.
96     */
97     struct yyparse_param_t {
98     LSCPServer* pServer;
99 schoenebeck 210 int hSession;
100     bool bVerbose; ///< if true then all commands will immediately sent back (echo)
101 schoenebeck 2515 bool bShellInteract; ///< if true: then client is the LSCP shell
102 schoenebeck 2516 bool bShellAutoCorrect; ///< if true: try to automatically correct obvious syntax mistakes
103 schoenebeck 2534 bool bShellSendLSCPDoc; ///< if true: send the relevant LSCP documentation reference section for the current command.
104 schoenebeck 1252 int iLine; ///< Current line (just for verbosity / messages)
105 schoenebeck 2531 int iColumn; ///< End of current line (just for verbosity / messages)
106     int iCursorOffset; ///< Column of cursor position in current line (reflected as offset to iColumn, range -n .. 0)
107 schoenebeck 2510 YYTYPE_INT16** ppStackBottom; ///< Bottom end of the Bison parser's state stack.
108     YYTYPE_INT16** ppStackTop; ///< Current position (heap) of the Bison parser's state stack.
109 schoenebeck 2534 lscp_ref_entry_t* pLSCPDocRef; ///< only if bShellSendLSCPDoc=true: points to the current LSCP doc reference, for being able to detect if another LSCP doc page has to be sent to the LSCP shell (client).
110 schoenebeck 210
111     yyparse_param_t() {
112     pServer = NULL;
113     hSession = -1;
114     bVerbose = false;
115 schoenebeck 2534 bShellInteract = bShellAutoCorrect = bShellSendLSCPDoc = false;
116 schoenebeck 2531 iCursorOffset = iLine = iColumn = 0;
117 schoenebeck 2510 ppStackBottom = ppStackTop = NULL;
118 schoenebeck 2534 pLSCPDocRef = NULL;
119 schoenebeck 210 }
120 schoenebeck 2531
121     void onNextLine() {
122     iLine++;
123     iColumn = 0;
124     iCursorOffset = 0;
125     }
126 schoenebeck 35 };
127     #define YYPARSE_PARAM yyparse_param
128    
129     /**
130     * Prototype of the main scanner function (lexical analyzer).
131     */
132 schoenebeck 219 #define YY_DECL int yylex(YYSTYPE* yylval)
133 schoenebeck 35
134 persson 1765 }
135    
136 schoenebeck 35 #endif // __LSCPPARSER_H__

  ViewVC Help
Powered by ViewVC