summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Trader/Interpreter.cpp
blob: 07afac4ce3f4dbfb3a06f018191a9895d73af3c3 (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
// $Id$

#include "Interpreter.h"

TAO_Interpreter::~TAO_Interpreter (void)
{
  delete root_;
}

int
TAO_Interpreter::build_tree(const char* constraints)
{
  TAO_Lex_String_Input::reset((char*)constraints);  
  int return_value = 0;

  yyval.constraint_ = 0;
  return_value = ::yyparse();
  
  if (return_value == 0 && yyval.constraint_ != 0)
    this->root_ = yyval.constraint_;
  else
    {
      while (yylex() > 0)
	;
      this->root_ = 0;
    }
  
  return return_value;
}


int
TAO_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;
}