summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Trader/Constraint.h
blob: ec0008d195b8a3b4aa1fd8fbdc67b6015e37db25 (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
/* -*- C++ -*- */

// ========================================================================
// $Id$
//
// = LIBRARY
//    orbsvcs
// 
// = FILENAME
//    Constraint.h
//
// = AUTHOR
//    Seth Widoff <sbw1@cs.wustl.edu>
//
// ========================================================================

#ifndef TAO_CONSTRAINT_H
#define TAO_CONSTRAINT_H

#include "Constraint_Nodes.h"

// Functions we need for parsing.
extern int yyparse(void);
extern void yyrestart(FILE*);
extern int yylex(void);

// Have yylex read from the constraint string, not from stdin.
#undef YY_INPUT
#define YY_INPUT(b, r, ms) (r = TAO_Lex_String_Input::copy_into(b, ms))

#undef yyerror
#define yyerror(x) 

class TAO_Lex_String_Input
// = TITLE
//   Stupid hack to have Lex read from a string and not from
//   stdin. Essentially, the interpreter needs to call yylex() until
//   EOF, and call TAO_Lex_String_Input::reset() with the new string,
//   prior to calling yyparse.
{
public:  

  static void reset(char* input_string);
  // Reset the lex input.
  
  static int copy_into(char* buf, int max_size);
  // Method lex will call to read from the input string.
  
private:

  static char* string_;
  static char* current_;
  static char* end_;
  // Pointers to keep track of the input string.
};

// The union used by lex and yacc to build the Abstract Syntax Tree.
typedef union
{
  TAO_Constraint* constraint_;	
} YYSTYPE;

extern YYSTYPE yylval;
extern YYSTYPE yyval;

#endif /* CONSTRAINT_H */