PostGIS  2.5.0dev-r@@SVN_REVISION@@
static int yy_get_next_buffer ( void  )
static

Definition at line 1253 of file lwin_wkt_lex.c.

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, wkt_yyin, wkt_yyrealloc(), wkt_yyrestart(), yy_buffer_state::yy_buf_size, YY_BUFFER_EOF_PENDING, yy_c_buf_p, yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER_LVALUE, YY_END_OF_BUFFER_CHAR, YY_FATAL_ERROR, YY_INPUT, yy_buffer_state::yy_is_our_buffer, YY_MORE_ADJ, yy_n_chars, YY_READ_BUF_SIZE, and yytext_ptr.

Referenced by while().

1254 {
1255  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1256  register char *source = (yytext_ptr);
1257  register int number_to_move, i;
1258  int ret_val;
1259 
1260  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1262  "fatal flex scanner internal error--end of buffer missed" );
1263 
1264  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1265  { /* Don't try to fill the buffer, so this is an EOF. */
1266  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1267  {
1268  /* We matched a single character, the EOB, so
1269  * treat this as a final EOF.
1270  */
1271  return EOB_ACT_END_OF_FILE;
1272  }
1273 
1274  else
1275  {
1276  /* We matched some text prior to the EOB, first
1277  * process it.
1278  */
1279  return EOB_ACT_LAST_MATCH;
1280  }
1281  }
1282 
1283  /* Try to read more data. */
1284 
1285  /* First move last chars to start of buffer. */
1286  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1287 
1288  for ( i = 0; i < number_to_move; ++i )
1289  *(dest++) = *(source++);
1290 
1291  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1292  /* don't do the read, it's not guaranteed to return an EOF,
1293  * just force an EOF
1294  */
1295  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1296 
1297  else
1298  {
1299  yy_size_t num_to_read =
1300  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1301 
1302  while ( num_to_read <= 0 )
1303  { /* Not enough room in the buffer - grow it. */
1304 
1305  /* just a shorter name for the current buffer */
1307 
1308  int yy_c_buf_p_offset =
1309  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1310 
1311  if ( b->yy_is_our_buffer )
1312  {
1313  yy_size_t new_size = b->yy_buf_size * 2;
1314 
1315  if ( new_size <= 0 )
1316  b->yy_buf_size += b->yy_buf_size / 8;
1317  else
1318  b->yy_buf_size *= 2;
1319 
1320  b->yy_ch_buf = (char *)
1321  /* Include room in for 2 EOB chars. */
1322  wkt_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1323  }
1324  else
1325  /* Can't grow it, we don't own it. */
1326  b->yy_ch_buf = 0;
1327 
1328  if ( ! b->yy_ch_buf )
1330  "fatal error - scanner input buffer overflow" );
1331 
1332  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1333 
1334  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1335  number_to_move - 1;
1336 
1337  }
1338 
1339  if ( num_to_read > YY_READ_BUF_SIZE )
1340  num_to_read = YY_READ_BUF_SIZE;
1341 
1342  /* Read in more data. */
1343  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1344  (yy_n_chars), num_to_read );
1345 
1346  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1347  }
1348 
1349  if ( (yy_n_chars) == 0 )
1350  {
1351  if ( number_to_move == YY_MORE_ADJ )
1352  {
1353  ret_val = EOB_ACT_END_OF_FILE;
1355  }
1356 
1357  else
1358  {
1359  ret_val = EOB_ACT_LAST_MATCH;
1360  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1362  }
1363  }
1364 
1365  else
1366  ret_val = EOB_ACT_CONTINUE_SCAN;
1367 
1368  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1369  /* Extend the array by 50%, plus the number we really need. */
1370  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1371  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wkt_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1372  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1373  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1374  }
1375 
1376  (yy_n_chars) += number_to_move;
1379 
1380  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1381 
1382  return ret_val;
1383 }
#define EOB_ACT_LAST_MATCH
Definition: lwin_wkt_lex.c:212
void * wkt_yyrealloc(void *, yy_size_t)
#define YY_INPUT(buf, result, max_size)
Definition: lwin_wkt_lex.c:797
FILE * wkt_yyin
Definition: lwin_wkt_lex.c:385
size_t yy_size_t
Definition: lwin_wkt_lex.c:203
void wkt_yyrestart(FILE *input_file)
Immediately switch to a different input stream.
#define EOB_ACT_END_OF_FILE
Definition: lwin_wkt_lex.c:211
#define YY_READ_BUF_SIZE
Definition: lwin_wkt_lex.c:782
#define YY_END_OF_BUFFER_CHAR
Definition: lwin_wkt_lex.c:185
static yy_size_t yy_n_chars
Definition: lwin_wkt_lex.c:319
#define YY_FATAL_ERROR(msg)
Definition: lwin_wkt_lex.c:844
#define YY_CURRENT_BUFFER_LVALUE
Definition: lwin_wkt_lex.c:315
#define YY_MORE_ADJ
Definition: lwin_wkt_lex.c:642
yy_size_t yy_buf_size
Definition: lwin_wkt_lex.c:244
static char * yy_c_buf_p
Definition: lwin_wkt_lex.c:323
#define YY_BUFFER_EOF_PENDING
Definition: lwin_wkt_lex.c:292
#define EOB_ACT_CONTINUE_SCAN
Definition: lwin_wkt_lex.c:210
#define yytext_ptr
Definition: lwin_wkt_lex.c:394

Here is the call graph for this function:

Here is the caller graph for this function: