MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / yylex_init_extra

Function yylex_init_extra

src/parser/ds_lexer.cpp:4883–4908  ·  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

4881 * the yyextra field.
4882 */
4883int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
4884{
4885 struct yyguts_t dummy_yyguts;
4886
4887 yyset_extra (yy_user_defined, &dummy_yyguts);
4888
4889 if (ptr_yy_globals == NULL){
4890 errno = EINVAL;
4891 return 1;
4892 }
4893
4894 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
4895
4896 if (*ptr_yy_globals == NULL){
4897 errno = ENOMEM;
4898 return 1;
4899 }
4900
4901 /* By setting to 0xAA, we expose bugs in
4902 yy_init_globals. Leave at 0x00 for releases. */
4903 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
4904
4905 yyset_extra (yy_user_defined, *ptr_yy_globals);
4906
4907 return yy_init_globals ( *ptr_yy_globals );
4908}
4909
4910static int yy_init_globals (yyscan_t yyscanner)
4911{

Callers

nothing calls this directly

Calls 3

yyset_extraFunction · 0.70
yyallocFunction · 0.70
yy_init_globalsFunction · 0.70

Tested by

no test coverage detected