Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

YY_BUFFER_STATE tp_scan_bytes ( yyconst char *  yybytes,
int  _yybytes_len 
)

Setup the input buffer state to scan the given bytes. The next call to tplex() will scan from a copy of bytes.

Parameters:
yybytes the byte buffer to scan
_yybytes_len the number of bytes in the buffer pointed to by bytes.
Returns:
the newly allocated buffer state object.

Definition at line 1577 of file tokenparser.c.

References tp_scan_buffer().

Referenced by tp_scan_string().

{
      YY_BUFFER_STATE b;
      char *buf;
      yy_size_t n;
      int i;
    
      /* Get memory for full buffer, including space for trailing EOB's. */
      n = _yybytes_len + 2;
      buf = (char *) tpalloc(n  );
      if ( ! buf )
            YY_FATAL_ERROR( "out of dynamic memory in tp_scan_bytes()" );

      for ( i = 0; i < _yybytes_len; ++i )
            buf[i] = yybytes[i];

      buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;

      b = tp_scan_buffer(buf,n );
      if ( ! b )
            YY_FATAL_ERROR( "bad buffer in tp_scan_bytes()" );

      /* It's okay to grow etc. this buffer, and we should throw it
       * away when we're done.
       */
      b->yy_is_our_buffer = 1;

      return b;
}


Generated by  Doxygen 1.6.0   Back to index