next up previous contents
Next: The Signal Class Up: The Parser Class Previous: Protected Members

Private Members

tex2html_wrap_inline7610 int get_line(): This private member function reads in a line of text from the standard input and stores it in the buffer of the Parser object. The line_num data member is incremented accordingly. If the parser already had a line cached as the result of a prior call to unget_line(), then no line is read in from standard input -- the line already in the buffer will be regarded as the current line of input.

tex2html_wrap_inline7610 void unget_line(): During the processing of the input stream, it is sometimes necessary for the parser to put a line back in the input stream when it has read too far ahead. The unget_line() member function does this by leaving the line in the buffer unchanged and setting the cached data member to TRUE. The function can ``unget'' a line only if at least one line has already been read and the cached data member is FALSE.

tex2html_wrap_inline7610 void error(char *err): This member function simply displays the supplied error message, the current line number and current text line to the diagnostic log stream, cerr. It is used to report errors encountered during the parsing of the input stream.

tex2html_wrap_inline7610 char *get_word(const char *delim = " "): This function implements an elementary tokenizer for the Parser class. Upon completion, this function will return the next token in the buffer that is delimited by one of the characters in the delim parameter. It makes use of a temporary buffer which is dynamically allocated by this method, if necessary. The library function strtok() is used to extract the tokens from the current line.

tex2html_wrap_inline7610 const int line_size: This variable represents the size of the buffer to be used by the parser to store each line of input. It is initialized by the Parser constructor. Its value should be larger than the length of the longest text line in the input stream.

tex2html_wrap_inline7610 int line_num: This data member keeps track of the number of lines currently read. When an error is encountered in the input stream, the line number stored in this variable is displayed to aid in the debugging process.

tex2html_wrap_inline7610 char *buffer: This data member stores the contents of the current line read from standard input. It is dynamically allocated by the Parser constructor. The get_line() member function actually stores the contents of the current line in the buffer.

tex2html_wrap_inline7610 char *tmp_buf: During execution of the tokenization function, get_word(), a copy of the line pointed to by the buffer data member is made and stored in tmp_buf. Doing this provides the tokenizer function with a copy of the buffer to manipulate without altering the original contents pointed to by buffer.

tex2html_wrap_inline7610 int cached: When a line is to be placed back into the input stream by the unget_line() member function, the cached data member is set to TRUE. This will inhibit a subsequent get_line() invocation from trying to read another line from standard input.

tex2html_wrap_inline7610 int read_one: Upon reading a line of text from the input stream, this data member is set to TRUE, indicating that at least one line of standard input has been successfully read. This boolean value is consulted by the unget_line() and get_word() member functions.

next up previous contents
Next: The Signal Class Up: The Parser Class Previous: Protected Members

Donald Craig
Mon Jul 8 12:05:35 NDT 1996