blob: 8a85f2bf3e4f232a90bde532543879973c6a4232 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// -*- C++ -*-
// $Id$
#include "ETCL_Interpreter.h"
#include "ETCL_Constraint.h"
#include "ace/Guard_T.h"
#include "ace/Thread_Mutex.h"
ACE_RCSID(ETCL, ETCL_Interpreter, "$Id$")
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_SYNCH_MUTEX TAO_ETCL_Interpreter::parserMutex__;
TAO_ETCL_Interpreter::TAO_ETCL_Interpreter (void)
: root_ (0)
{
}
TAO_ETCL_Interpreter::~TAO_ETCL_Interpreter (void)
{
delete this->root_;
}
int
TAO_ETCL_Interpreter::build_tree (const char* constraints)
{
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
guard,
TAO_ETCL_Interpreter::parserMutex__,
-1);
TAO_Lex_String_Input::reset ((char*)constraints);
yyval.constraint = 0;
int return_value = ::yyparse ();
if (return_value == 0 && yyval.constraint != 0)
{
this->root_ = yyval.constraint;
}
else
{
this->root_ = 0;
}
return return_value;
}
int
TAO_ETCL_Interpreter::is_empty_string (const char* str)
{
int return_value = 0;
if (str != 0)
{
int i = 0;
while (str[i] != '\0')
{
if (str[i] != ' ')
{
break;
}
i++;
}
if (str[i] == '\0')
{
return_value = 1;
}
}
return return_value;
}
char* TAO_Lex_String_Input::string_ = 0;
char* TAO_Lex_String_Input::current_ = 0;
char* TAO_Lex_String_Input::end_ = 0;
// Routine to have Lex read its input from the constraint string.
int
TAO_Lex_String_Input::copy_into (char* buf,
int max_size)
{
int chars_left = TAO_Lex_String_Input::end_ - TAO_Lex_String_Input::current_;
int n = max_size > chars_left ? chars_left : max_size;
if (n > 0)
{
ACE_OS:: memcpy (buf,
TAO_Lex_String_Input::current_,
n);
TAO_Lex_String_Input::current_ += n;
}
return n;
}
void
TAO_Lex_String_Input::reset (char* input_string)
{
TAO_Lex_String_Input::string_ = input_string;
TAO_Lex_String_Input::current_ = input_string;
TAO_Lex_String_Input::end_ =
input_string + ACE_OS::strlen (TAO_Lex_String_Input::string_);
}
TAO_END_VERSIONED_NAMESPACE_DECL
|