engine/source/preprocessorlib/pp_parser.c
/**
 * Initializes a preprocessor context.  Assumes that this context either hasn't
 * been initialized yet or has been destroyed since the last time it was initialized.
 */
Initializes a preprocessor context.  Assumes that this context either hasn't
been initialized yet or has been destroyed since the last time it was initialized.
Initializes a preprocessor context . Assumes that this context either hasn ' t been initialized yet or has been destroyed since the last time it was initialized .
void pp_context_init(pp_context *self)
{
    char buf[64];
    time_t currentTime = time(NULL);
    char *datetime = ctime(&currentTime);
    List_Init(&self->macros);
    List_Init(&self->func_macros);
    List_Init(&self->imports);
    self->conditionals.all = 0ll;
    self->num_conditionals = 0;
    strcpy(buf, "\"");
    strncat(buf, datetime + 4, 7);
    strncat(buf, datetime + 20, 4);
    strcat(buf, "\"");
    List_InsertAfter(&self->macros, strdup(buf), "__DATE__");
    strcpy(buf, "\"");
    strncat(buf, datetime + 11, 8);
    strcat(buf, "\"");
    List_InsertAfter(&self->macros, strdup(buf), "__TIME__");
#if PP_TEST
    List_InsertAfter(&self->macros, strdup("1"), "__STDC__");
    List_InsertAfter(&self->macros, strdup("1"), "__STDC_HOSTED__");
    List_InsertAfter(&self->macros, strdup("199901L"), "__STDC_VERSION__");
#endif
}
void pp_context_init ( pp_context * self ) { char buf [ 64 ] ; time_t currentTime = time ( NULL ) ; char * datetime = ctime ( & currentTime ) ; List_Init ( & self -> macros ) ; List_Init ( & self -> func_macros ) ; List_Init ( & self -> imports ) ; self -> conditionals . all = 0ll ; self -> num_conditionals = 0 ; strcpy ( buf , " \" " ) ; strncat ( buf , datetime + 4 , 7 ) ; strncat ( buf , datetime + 20 , 4 ) ; strcat ( buf , " \" " ) ; List_InsertAfter ( & self -> macros , strdup ( buf ) , " " ) ; strcpy ( buf , " \" " ) ; strncat ( buf , datetime + 11 , 8 ) ; strcat ( buf , " \" " ) ; List_InsertAfter ( & self -> macros , strdup ( buf ) , " " ) ; #if PP_TEST List_InsertAfter ( & self -> macros , strdup ( " " ) , " " ) ; List_InsertAfter ( & self -> macros , strdup ( " " ) , " " ) ; List_InsertAfter ( & self -> macros , strdup ( " " ) , " " ) ; #endif }
Initializes a preprocessor context.
Initializes a preprocessor context .
// initialize the macro lists // initialize the import list // initialize the conditional stack // initialize the builtin macros other than __FILE__ and __LINE__