Please enable JavaScript to view this site.

ESL Documentation

Navigation: ESL Documentation > ESL Local Applications > Sending and Receiving Data

How response to line and response to char are Processed

Scroll Prev Top Next More

When a match clause is satisfied and the response definition is invoked, all characters up to and including the matched pattern are copied to the built-in function input.  Further pattern matching will begin at the next character (any character, including newline, special character, blank, etc.) in the input stream; this character position becomes column 1 of the input stream.

In a response to line statement, characters are accepted and are buffered until a newline character is encountered.  At this point, ESL will look for a match in the response definition.  If no match is found, the buffer is cleared up to that point.  If a match is found, the input function returns the entire line, and the buffer is cleared up to that point.  The next line that ESL examines for a match begins with the first column position following the newline character.

In a response to char response statement, characters are accepted and examined upon receipt for a match.  If no match is found, the character is buffered until a newline character is encountered, at which point the buffer is cleared up to the newline character, and ESL begins further examination at the next column position, which is now called column position 1.  If a match is found, the input function returns the characters in the buffer up to and including the last character of the match clause, and the buffer will be cleared up to that point.  For example:

 

response to char "end" from        Prog

   ...

response to char        col 9 thru 11 "32a" from        Prog

   ...

Assume that the input stream from Prog is the following:

 

This is the end of file 32a\n

 

When the first response is taken, the characters "This is the end" are copied to input.  When the second response is taken, the characters "of file 32a" are copied to input.  The newline character, "\n", is not part of the buffer when "32a" is matched.