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

Definition at line 1225 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, 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 input(), and while().

1226 {
1227  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1228  register char *source = (yytext_ptr);
1229  register int number_to_move, i;
1230  int ret_val;
1231 
1232  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1234  "fatal flex scanner internal error--end of buffer missed" );
1235 
1236  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1237  { /* Don't try to fill the buffer, so this is an EOF. */
1238  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1239  {
1240  /* We matched a single character, the EOB, so
1241  * treat this as a final EOF.
1242  */
1243  return EOB_ACT_END_OF_FILE;
1244  }
1245 
1246  else
1247  {
1248  /* We matched some text prior to the EOB, first
1249  * process it.
1250  */
1251  return EOB_ACT_LAST_MATCH;
1252  }
1253  }
1254 
1255  /* Try to read more data. */
1256 
1257  /* First move last chars to start of buffer. */
1258  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1259 
1260  for ( i = 0; i < number_to_move; ++i )
1261  *(dest++) = *(source++);
1262 
1263  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1264  /* don't do the read, it's not guaranteed to return an EOF,
1265  * just force an EOF
1266  */
1267  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1268 
1269  else
1270  {
1271  yy_size_t num_to_read =
1272  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1273 
1274  while ( num_to_read <= 0 )
1275  { /* Not enough room in the buffer - grow it. */
1276 
1277  /* just a shorter name for the current buffer */
1279 
1280  int yy_c_buf_p_offset =
1281  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1282 
1283  if ( b->yy_is_our_buffer )
1284  {
1285  yy_size_t new_size = b->yy_buf_size * 2;
1286 
1287  if ( new_size <= 0 )
1288  b->yy_buf_size += b->yy_buf_size / 8;
1289  else
1290  b->yy_buf_size *= 2;
1291 
1292  b->yy_ch_buf = (char *)
1293  /* Include room in for 2 EOB chars. */
1294  wkt_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1295  }
1296  else
1297  /* Can't grow it, we don't own it. */
1298  b->yy_ch_buf = 0;
1299 
1300  if ( ! b->yy_ch_buf )
1302  "fatal error - scanner input buffer overflow" );
1303 
1304  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1305 
1306  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1307  number_to_move - 1;
1308 
1309  }
1310 
1311  if ( num_to_read > YY_READ_BUF_SIZE )
1312  num_to_read = YY_READ_BUF_SIZE;
1313 
1314  /* Read in more data. */
1315  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1316  (yy_n_chars), num_to_read );
1317 
1318  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1319  }
1320 
1321  if ( (yy_n_chars) == 0 )
1322  {
1323  if ( number_to_move == YY_MORE_ADJ )
1324  {
1325  ret_val = EOB_ACT_END_OF_FILE;
1327  }
1328 
1329  else
1330  {
1331  ret_val = EOB_ACT_LAST_MATCH;
1332  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1334  }
1335  }
1336 
1337  else
1338  ret_val = EOB_ACT_CONTINUE_SCAN;
1339 
1340  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1341  /* Extend the array by 50%, plus the number we really need. */
1342  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1343  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wkt_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1344  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1345  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1346  }
1347 
1348  (yy_n_chars) += number_to_move;
1351 
1352  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1353 
1354  return ret_val;
1355 }
#define EOB_ACT_LAST_MATCH
Definition: lwin_wkt_lex.c:186
void * wkt_yyrealloc(void *, yy_size_t)
#define YY_INPUT(buf, result, max_size)
Definition: lwin_wkt_lex.c:769
FILE * wkt_yyin
Definition: lwin_wkt_lex.c:359
size_t yy_size_t
Definition: lwin_wkt_lex.c:177
#define YY_CURRENT_BUFFER
Definition: lwin_wkt_lex.c:282
void wkt_yyrestart(FILE *input_file)
Immediately switch to a different input stream.
#define EOB_ACT_END_OF_FILE
Definition: lwin_wkt_lex.c:185
#define YY_READ_BUF_SIZE
Definition: lwin_wkt_lex.c:754
#define YY_END_OF_BUFFER_CHAR
Definition: lwin_wkt_lex.c:159
static yy_size_t yy_n_chars
Definition: lwin_wkt_lex.c:293
#define YY_FATAL_ERROR(msg)
Definition: lwin_wkt_lex.c:816
#define YY_CURRENT_BUFFER_LVALUE
Definition: lwin_wkt_lex.c:289
#define YY_MORE_ADJ
Definition: lwin_wkt_lex.c:616
yy_size_t yy_buf_size
Definition: lwin_wkt_lex.c:218
static char * yy_c_buf_p
Definition: lwin_wkt_lex.c:297
#define YY_BUFFER_EOF_PENDING
Definition: lwin_wkt_lex.c:266
#define EOB_ACT_CONTINUE_SCAN
Definition: lwin_wkt_lex.c:184
#define yytext_ptr
Definition: lwin_wkt_lex.c:368

Here is the call graph for this function:

Here is the caller graph for this function: