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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 64 by schoenebeck, Thu May 6 20:06:20 2004 UTC revision 210 by schoenebeck, Sat Jul 24 12:33:49 2004 UTC
# Line 32  Line 32 
32  #include <string>  #include <string>
33    
34  #include "../common/global.h"  #include "../common/global.h"
35    #include "lscpevent.h"
36  #include "../Sampler.h"  #include "../Sampler.h"
37    
38  /// Will be returned by the parser in case of syntax errors.  /// Will be returned by the parser in case of syntax errors.
39  #define LSCP_SYNTAX_ERROR       -69  #define LSCP_SYNTAX_ERROR       -69
40    #define LSCP_QUIT               -1
41    #define LSCP_DONE               0
42    
43  using namespace LinuxSampler;  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.   * How the fill states of disk stream buffers should be reflected.
50   */   */
# Line 57  enum fill_response_t { Line 63  enum fill_response_t {
63   */   */
64  struct YYSTYPE {  struct YYSTYPE {
65      union {      union {
66          char                      Char;          char            Char;
67          unsigned int              Number;          unsigned int    Number;
68          double                    Dotnum;          double          Dotnum;
69          fill_response_t           FillResponse;          fill_response_t FillResponse;
70          AudioOutputDevice::type_t AudioOutput;          LSCPEvent::event_t Event;
         MidiInputDevice::type_t   MidiInput;  
71      };      };
72      std::string  String;      std::string                       String;
73        std::map<std::string,std::string> KeyValList;
74  };  };
75  #define yystype YYSTYPE         ///< For backward compatibility.  #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.  #define YYSTYPE_IS_DECLARED     ///< We tell the lexer / parser that we use our own data structure as defined above.
77    
 // just symbol prototyping  
 class LSCPServer;  
   
78  // pointer to an (reentrant) scanner / lexical analyzer  // pointer to an (reentrant) scanner / lexical analyzer
79  typedef void* yyscan_t;  typedef void* yyscan_t;
80    
# Line 80  typedef void* yyscan_t; Line 83  typedef void* yyscan_t;
83   */   */
84  struct yyparse_param_t {  struct yyparse_param_t {
85      LSCPServer* pServer;      LSCPServer* pServer;
86        int         hSession;
87      yyscan_t    pScanner;      yyscan_t    pScanner;
88        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  };  };
97  #define YYPARSE_PARAM yyparse_param  #define YYPARSE_PARAM yyparse_param
98    
# Line 93  struct yyparse_param_t { Line 105  struct yyparse_param_t {
105   * Override lex's input function which just reads from stdin by default.   * Override lex's input function which just reads from stdin by default.
106   * We read from a socket instead.   * We read from a socket instead.
107   */   */
108    extern int GetLSCPCommand( void *buf, int max_size);
109  #define YY_INPUT(buf,result,max_size) \  #define YY_INPUT(buf,result,max_size) \
110          errno=0; \          result = GetLSCPCommand(buf, max_size)
         while ( (result = recv(hSession, buf, max_size, 0)) < 0 ) \  
         { \  
                 if(errno != EINTR) \  
                 { \  
                         switch(errno) { \  
                                 case EBADF: \  
                                         dmsg(2,("LSCPScanner: The argument s is an invalid descriptor.\n")); \  
                                         break; \  
                                 case ECONNREFUSED: \  
                                         dmsg(2,("LSCPScanner: A remote host refused to allow the network connection (typically because it is not running the requested service).\n")); \  
                                         break; \  
                                 case ENOTCONN: \  
                                         dmsg(2,("LSCPScanner: The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2)).\n")); \  
                                         break; \  
                                 case ENOTSOCK: \  
                                         dmsg(2,("LSCPScanner: The argument s does not refer to a socket.\n")); \  
                                         break; \  
                                 case EAGAIN: \  
                                         dmsg(2,("LSCPScanner: The socket is marked non-blocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received.\n")); \  
                                         break; \  
                                 case EINTR: \  
                                         dmsg(2,("LSCPScanner: The receive was interrupted by delivery of a signal before any data were available.\n")); \  
                                         break; \  
                                 case EFAULT: \  
                                         dmsg(2,("LSCPScanner: The receive buffer pointer(s) point outside the process's address space.\n")); \  
                                         break; \  
                                 case EINVAL: \  
                                         dmsg(2,("LSCPScanner: Invalid argument passed.\n")); \  
                                         break; \  
                                 case ENOMEM: \  
                                         dmsg(2,("LSCPScanner: Could not allocate memory for recvmsg.\n")); \  
                                         break; \  
                                 default: \  
                                         dmsg(2,("LSCPScanner: Unknown recv() error.\n")); \  
                                         break; \  
                         } \  
                         YY_FATAL_ERROR( "input in flex scanner failed" ); \  
                         break; \  
                 } \  
                 errno=0; \  
                 clearerr(yyin); \  
         }\  
   
111    
112  #endif // __LSCPPARSER_H__  #endif // __LSCPPARSER_H__

Legend:
Removed from v.64  
changed lines
  Added in v.210

  ViewVC Help
Powered by ViewVC