MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / yy_get_next_buffer

Function yy_get_next_buffer

Engine/source/console/CMDscan.cpp:1434–1559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1432 */
1433
1434static int yy_get_next_buffer()
1435 {
1436 register char *dest = yy_current_buffer->yy_ch_buf;
1437 register char *source = yytext_ptr;
1438 register int number_to_move, i;
1439 int ret_val;
1440
1441 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1442 YY_FATAL_ERROR(
1443 "fatal flex scanner internal error--end of buffer missed" );
1444
1445 if ( yy_current_buffer->yy_fill_buffer == 0 )
1446 { /* Don't try to fill the buffer, so this is an EOF. */
1447 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1448 {
1449 /* We matched a singled characater, the EOB, so
1450 * treat this as a final EOF.
1451 */
1452 return EOB_ACT_END_OF_FILE;
1453 }
1454
1455 else
1456 {
1457 /* We matched some text prior to the EOB, first
1458 * process it.
1459 */
1460 return EOB_ACT_LAST_MATCH;
1461 }
1462 }
1463
1464 /* Try to read more data. */
1465
1466 /* First move last chars to start of buffer. */
1467 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1468
1469 for ( i = 0; i < number_to_move; ++i )
1470 *(dest++) = *(source++);
1471
1472 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1473 /* don't do the read, it's not guaranteed to return an EOF,
1474 * just force an EOF
1475 */
1476 yy_n_chars = 0;
1477
1478 else
1479 {
1480 int num_to_read =
1481 yy_current_buffer->yy_buf_size - number_to_move - 1;
1482
1483 while ( num_to_read <= 0 )
1484 { /* Not enough room in the buffer - grow it. */
1485#ifdef YY_USES_REJECT
1486 YY_FATAL_ERROR(
1487"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1488#else
1489
1490 /* just a shorter name for the current buffer */
1491 YY_BUFFER_STATE b = yy_current_buffer;

Callers 2

CMDscan.cppFile · 0.85
inputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected