Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / ETCL / ETCL_Interpreter.cpp
blob79f06d1e18db9cf47a582331f56b455960656fe7
1 // -*- C++ -*-
2 #include "ace/Guard_T.h"
3 #include "ace/Truncate.h"
4 #include "ace/OS_NS_string.h"
6 #include "ace/ETCL/ETCL_Interpreter.h"
7 #include "ace/ETCL/ETCL_Constraint.h"
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 ETCL_Parser_Export ACE_SYNCH_MUTEX ETCL_Interpreter::parserMutex__;
13 ETCL_Interpreter::ETCL_Interpreter ()
14 : root_ (0)
18 ETCL_Interpreter::~ETCL_Interpreter ()
20 delete this->root_;
23 int
24 ETCL_Interpreter::build_tree (const char* constraints)
26 ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
27 guard,
28 ETCL_Interpreter::parserMutex__,
29 -1);
31 Lex_String_Input::reset ((char*)constraints);
33 yyval.constraint = 0;
34 int return_value = ::yyparse ();
36 if (return_value == 0 && yyval.constraint != 0)
38 this->root_ = yyval.constraint;
40 else
42 this->root_ = 0;
45 return return_value;
48 int
49 ETCL_Interpreter::is_empty_string (const char* str)
51 int return_value = 0;
53 if (str != 0)
55 int i = 0;
57 while (str[i] != '\0')
59 if (str[i] != ' ')
61 break;
64 ++i;
67 if (str[i] == '\0')
69 return_value = 1;
73 return return_value;
76 char* Lex_String_Input::string_ = 0;
77 char* Lex_String_Input::current_ = 0;
78 char* Lex_String_Input::end_ = 0;
80 // Routine to have Lex read its input from the constraint string.
82 int
83 Lex_String_Input::copy_into (char* buf,
84 int max_size)
86 int const chars_left =
87 ACE_Utils::truncate_cast<int> (
88 Lex_String_Input::end_ - Lex_String_Input::current_);
90 int const n = max_size > chars_left ? chars_left : max_size;
92 if (n > 0)
94 ACE_OS::memcpy (buf,
95 Lex_String_Input::current_,
96 n);
97 Lex_String_Input::current_ += n;
100 return n;
103 void
104 Lex_String_Input::reset (char* input_string)
106 Lex_String_Input::string_ = input_string;
107 Lex_String_Input::current_ = input_string;
108 Lex_String_Input::end_ =
109 input_string + ACE_OS::strlen (Lex_String_Input::string_);
112 ACE_END_VERSIONED_NAMESPACE_DECL