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

Definition at line 1228 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: