TAO_Lex_String_Input Class Reference

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. More...

#include <Interpreter.h>

List of all members.

Static Public Member Functions

void reset (char *input_string)
 Reset the lex input.

int copy_into (char *buf, int max_size)
 Method lex will call to read from the input string.


Static Private Attributes

char * string_ = 0
 Pointers to keep track of the input string.

char * current_ = 0
char * end_ = 0


Detailed Description

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.

Definition at line 78 of file Interpreter.h.


Member Function Documentation

int TAO_Lex_String_Input::copy_into char *  buf,
int  max_size
[static]
 

Method lex will call to read from the input string.

Definition at line 76 of file Interpreter.cpp.

References current_, end_, and ACE_OS::memcpy().

00077 {
00078   int chars_left =  TAO_Lex_String_Input::end_ - TAO_Lex_String_Input::current_;
00079   int n = max_size > chars_left ? chars_left : max_size;
00080 
00081   if (n > 0)
00082     {
00083       ACE_OS:: memcpy (buf,
00084                        TAO_Lex_String_Input::current_,
00085                        n);
00086       TAO_Lex_String_Input::current_ += n;
00087     }
00088 
00089   return n;
00090 }

void TAO_Lex_String_Input::reset char *  input_string  )  [static]
 

Reset the lex input.

Definition at line 93 of file Interpreter.cpp.

References current_, end_, string_, and ACE_OS::strlen().

Referenced by TAO_Interpreter::build_tree().

00094 {
00095   TAO_Lex_String_Input::string_ = input_string;
00096   TAO_Lex_String_Input::current_ = input_string;
00097   TAO_Lex_String_Input::end_ = input_string +
00098     ACE_OS::strlen (TAO_Lex_String_Input::string_);
00099 }


Member Data Documentation

char * TAO_Lex_String_Input::current_ = 0 [static, private]
 

Definition at line 70 of file Interpreter.cpp.

Referenced by copy_into(), and reset().

char * TAO_Lex_String_Input::end_ = 0 [static, private]
 

Definition at line 71 of file Interpreter.cpp.

Referenced by copy_into(), and reset().

char * TAO_Lex_String_Input::string_ = 0 [static, private]
 

Pointers to keep track of the input string.

Definition at line 69 of file Interpreter.cpp.

Referenced by reset().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:00:52 2006 for TAO_CosTrader by doxygen 1.3.6