diff options
Diffstat (limited to 'ace/Svc_Conf.h')
-rw-r--r-- | ace/Svc_Conf.h | 104 |
1 files changed, 8 insertions, 96 deletions
diff --git a/ace/Svc_Conf.h b/ace/Svc_Conf.h index 4c14981caa3..4a0794a9077 100644 --- a/ace/Svc_Conf.h +++ b/ace/Svc_Conf.h @@ -28,13 +28,12 @@ #include "ace/Service_Config.h" #include "ace/Parse_Node.h" +#include "ace/Svc_Conf_Param.h" + #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// Forward declarations. -struct ace_yy_buffer_state; - // The following yylex() declarations require support for reentrant // parser generation (e.g. from GNU Bison). #if defined (DEBUGGING) @@ -46,98 +45,11 @@ struct ace_yy_buffer_state; #define ACE_YY_DECL extern "C" int ace_yylex (ACE_YYSTYPE *ace_yylval, void *ACE_YYLEX_PARAM) #endif /* DEBUGGING */ -extern void ace_yy_delete_buffer (ace_yy_buffer_state *buffer); - -/** - * @class ACE_Svc_Conf_Param - * - * @brief An instance of this object will be passed down to the - * yyparse() and yylex() functions. - * - * This class retains the state for a given parse/scan. It primarily - * makes it possible to hold the static object lock in the scanner - * for as short a period of time as possible. The resulting finer - * grained locking prevents deadlocks from occuring when scanning a - * `svc.conf' file and activating an ACE_Task, for example, as a - * result of processing the directives in that file. - */ -class ACE_Svc_Conf_Param -{ -public: - - enum SVC_CONF_PARAM_TYPE - { - /// The lexer will scan a file containing one or more directives. - SVC_CONF_FILE, - - /// The lexer will scan a string containing a directive. - SVC_CONF_DIRECTIVE - }; - - /// Constructor - ACE_Svc_Conf_Param (FILE *file) - : type (SVC_CONF_FILE), - yyerrno (0), - yylineno (1), - buffer (0), - obstack () - { - source.file = file; - } - - /// Constructor - ACE_Svc_Conf_Param (const ACE_TCHAR *directive) - : type (SVC_CONF_DIRECTIVE), - yyerrno (0), - yylineno (1), - buffer (0), - obstack () - { - source.directive = directive; - } - - ~ACE_Svc_Conf_Param (void) - { - ace_yy_delete_buffer (this->buffer); - } - -public: - - union - { - /// FILE stream from which directives will be scanned and parsed. - FILE *file; - - /// String containing directive that will be scanned and parsed. - const ACE_TCHAR *directive; - - } source; - - /// Discriminant use to determine which union member to use. - SVC_CONF_PARAM_TYPE type; - - /// Keeps track of the number of errors encountered so far. - int yyerrno; - - /// Keeps track of the current line number for error-handling routine. - int yylineno; - - /// Lexer buffer that corresponds to the current Service - /// Configurator file/direct scan. - ace_yy_buffer_state *buffer; - - /// Obstack used for efficient memory allocation when - /// parsing/scanning a service configurator directive. - ACE_Obstack_T<ACE_TCHAR> obstack; - -}; - -// Parameter that is passed down to the yyparse() function, and -// eventually to yylex(). -#define ACE_YYPARSE_PARAM ace_svc_conf_parameter -#define ACE_YYLEX_PARAM ACE_YYPARSE_PARAM - -#define ACE_SVC_CONF_PARAM (static_cast<ACE_Svc_Conf_Param *> (ACE_YYLEX_PARAM)) +// Forward declarations +class ACE_Location_Node; +class ACE_Parse_Node; +class ACE_Static_Node; +class ACE_Service_Type_Factory; // The following definition for the ACE_YYSTYPE must occur before // ACE_YY_DECL is declared since ACE_YY_DECL expands to function @@ -148,7 +60,7 @@ typedef union ACE_Location_Node *location_node_; ACE_Parse_Node *parse_node_; ACE_Static_Node *static_node_; - ACE_Service_Type *svc_record_; + ACE_Service_Type_Factory *svc_record_; ACE_TCHAR *ident_; } ACE_YYSTYPE; |