Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */
| 4686 | * @return the newly allocated buffer state object. |
| 4687 | */ |
| 4688 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
| 4689 | { |
| 4690 | YY_BUFFER_STATE b; |
| 4691 | |
| 4692 | if ( size < 2 || |
| 4693 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 4694 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
| 4695 | /* They forgot to leave room for the EOB's. */ |
| 4696 | return NULL; |
| 4697 | |
| 4698 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
| 4699 | if ( ! b ) |
| 4700 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
| 4701 | |
| 4702 | b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
| 4703 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 4704 | b->yy_is_our_buffer = 0; |
| 4705 | b->yy_input_file = NULL; |
| 4706 | b->yy_n_chars = b->yy_buf_size; |
| 4707 | b->yy_is_interactive = 0; |
| 4708 | b->yy_at_bol = 1; |
| 4709 | b->yy_fill_buffer = 0; |
| 4710 | b->yy_buffer_status = YY_BUFFER_NEW; |
| 4711 | |
| 4712 | yy_switch_to_buffer( b , yyscanner ); |
| 4713 | |
| 4714 | return b; |
| 4715 | } |
| 4716 | |
| 4717 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
| 4718 | * scan from a @e copy of @a str. |
no test coverage detected