MCPcopy Create free account
hub / github.com/Gecode/gecode / yylex_init_extra

Function yylex_init_extra

gecode/flatzinc/lexer.yy.cpp:2369–2394  ·  view source on GitHub ↗

yylex_init_extra has the same functionality as yylex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). * The user defined value in the first argument will be available to yyalloc in * the yy

Source from the content-addressed store, hash-verified

2367 * the yyextra field.
2368 */
2369int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2370{
2371 struct yyguts_t dummy_yyguts;
2372
2373 yyset_extra (yy_user_defined, &dummy_yyguts);
2374
2375 if (ptr_yy_globals == NULL){
2376 errno = EINVAL;
2377 return 1;
2378 }
2379
2380 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2381
2382 if (*ptr_yy_globals == NULL){
2383 errno = ENOMEM;
2384 return 1;
2385 }
2386
2387 /* By setting to 0xAA, we expose bugs in
2388 yy_init_globals. Leave at 0x00 for releases. */
2389 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2390
2391 yyset_extra (yy_user_defined, *ptr_yy_globals);
2392
2393 return yy_init_globals ( *ptr_yy_globals );
2394}
2395
2396static int yy_init_globals (yyscan_t yyscanner)
2397{

Callers

nothing calls this directly

Calls 3

yyset_extraFunction · 0.85
yyallocFunction · 0.85
yy_init_globalsFunction · 0.85

Tested by

no test coverage detected