/[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 135 by senkov, Sun Jun 20 16:01:50 2004 UTC revision 170 by senkov, Sat Jul 3 20:08:07 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 48  enum fill_response_t { Line 54  enum fill_response_t {
54  };  };
55    
56  /**  /**
  * Event types  
  */  
 enum event_t {  
     event_channels,  
     event_voice_count,  
     event_stream_count,  
     event_channel_buffer_fill,  
     event_channel_info,  
     event_misc  
 };  
   
 /**  
57   * Semantic value of the lookahead symbol.   * Semantic value of the lookahead symbol.
58   *   *
59   * Structure that is used by the parser to process and return values from the   * Structure that is used by the parser to process and return values from the
# Line 73  struct YYSTYPE { Line 67  struct YYSTYPE {
67          unsigned int    Number;          unsigned int    Number;
68          double          Dotnum;          double          Dotnum;
69          fill_response_t FillResponse;          fill_response_t FillResponse;
70          event_t         Event;          LSCPEvent::event_t Event;
71      };      };
72      std::string                       String;      std::string                       String;
73      std::map<std::string,std::string> KeyValList;      std::map<std::string,std::string> KeyValList;
# Line 81  struct YYSTYPE { Line 75  struct YYSTYPE {
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 105  struct yyparse_param_t { Line 96  struct yyparse_param_t {
96   * Override lex's input function which just reads from stdin by default.   * Override lex's input function which just reads from stdin by default.
97   * We read from a socket instead.   * We read from a socket instead.
98   */   */
99    extern int GetLSCPCommand( void *buf, int max_size);
100  #define YY_INPUT(buf,result,max_size) \  #define YY_INPUT(buf,result,max_size) \
101          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); \  
         }\  
   
102    
103  #endif // __LSCPPARSER_H__  #endif // __LSCPPARSER_H__

Legend:
Removed from v.135  
changed lines
  Added in v.170

  ViewVC Help
Powered by ViewVC