MCPcopy Create free account
hub / github.com/amule-project/amule / yy_get_next_buffer

Function yy_get_next_buffer

src/Scanner.cpp:1156–1290  ·  view source on GitHub ↗

yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */

Source from the content-addressed store, hash-verified

1154 * EOB_ACT_END_OF_FILE - end of file
1155 */
1156static int yy_get_next_buffer (void)
1157{
1158 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1159 char *source = (yytext_ptr);
1160 int number_to_move, i;
1161 int ret_val;
1162
1163 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1164 YY_FATAL_ERROR(
1165 "fatal flex scanner internal error--end of buffer missed" );
1166
1167 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1168 { /* Don't try to fill the buffer, so this is an EOF. */
1169 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1170 {
1171 /* We matched a single character, the EOB, so
1172 * treat this as a final EOF.
1173 */
1174 return EOB_ACT_END_OF_FILE;
1175 }
1176
1177 else
1178 {
1179 /* We matched some text prior to the EOB, first
1180 * process it.
1181 */
1182 return EOB_ACT_LAST_MATCH;
1183 }
1184 }
1185
1186 /* Try to read more data. */
1187
1188 /* First move last chars to start of buffer. */
1189 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1190
1191 for ( i = 0; i < number_to_move; ++i )
1192 *(dest++) = *(source++);
1193
1194 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1195 /* don't do the read, it's not guaranteed to return an EOF,
1196 * just force an EOF
1197 */
1198 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1199
1200 else
1201 {
1202 int num_to_read =
1203 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1204
1205 while ( num_to_read <= 0 )
1206 { /* Not enough room in the buffer - grow it. */
1207
1208 /* just a shorter name for the current buffer */
1209 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1210
1211 int yy_c_buf_p_offset =
1212 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1213

Callers 2

Scanner.cppFile · 0.70
inputFunction · 0.70

Calls 1

yyrestartFunction · 0.70

Tested by

no test coverage detected