mojoshader_compiler.c
changeset 945 f00ea3986db8
parent 940 bc2a5efade5e
child 958 02e7826c8c75
equal deleted inserted replaced
944:9f9fa9650772 945:f00ea3986db8
  2366     memset(retval, '\0', sizeof (MOJOSHADER_astData));
  2366     memset(retval, '\0', sizeof (MOJOSHADER_astData));
  2367     retval->source_profile = ctx->source_profile;
  2367     retval->source_profile = ctx->source_profile;
  2368     retval->malloc = (ctx->malloc == MOJOSHADER_internal_malloc) ? NULL : ctx->malloc;
  2368     retval->malloc = (ctx->malloc == MOJOSHADER_internal_malloc) ? NULL : ctx->malloc;
  2369     retval->free = (ctx->free == MOJOSHADER_internal_free) ? NULL : ctx->free;
  2369     retval->free = (ctx->free == MOJOSHADER_internal_free) ? NULL : ctx->free;
  2370     retval->malloc_data = ctx->malloc_data;
  2370     retval->malloc_data = ctx->malloc_data;
  2371     retval->error_count = ctx->errors->count;
  2371     retval->error_count = errorlist_count(ctx->errors);
  2372     retval->errors = errorlist_flatten(ctx->errors);
  2372     retval->errors = errorlist_flatten(ctx->errors);
  2373 
  2373 
  2374     if (ctx->out_of_memory)
  2374     if (ctx->out_of_memory)
  2375     {
  2375     {
  2376         Free(ctx, retval);
  2376         Free(ctx, retval);
  2401     {
  2401     {
  2402         retval->source_profile = ctx->source_profile;
  2402         retval->source_profile = ctx->source_profile;
  2403         retval->ast = ctx->ast;
  2403         retval->ast = ctx->ast;
  2404     } // if
  2404     } // if
  2405 
  2405 
  2406     retval->error_count = ctx->errors->count;
  2406     retval->error_count = errorlist_count(ctx->errors);
  2407     retval->errors = errorlist_flatten(ctx->errors);
  2407     retval->errors = errorlist_flatten(ctx->errors);
  2408     if (ctx->out_of_memory)
  2408     if (ctx->out_of_memory)
  2409     {
  2409     {
  2410         Free(ctx, retval);
  2410         Free(ctx, retval);
  2411         return &MOJOSHADER_out_of_mem_ast_data;
  2411         return &MOJOSHADER_out_of_mem_ast_data;
  2460     memset(retval, '\0', sizeof (MOJOSHADER_compileData));
  2460     memset(retval, '\0', sizeof (MOJOSHADER_compileData));
  2461     retval->malloc = (ctx->malloc == MOJOSHADER_internal_malloc) ? NULL : ctx->malloc;
  2461     retval->malloc = (ctx->malloc == MOJOSHADER_internal_malloc) ? NULL : ctx->malloc;
  2462     retval->free = (ctx->free == MOJOSHADER_internal_free) ? NULL : ctx->free;
  2462     retval->free = (ctx->free == MOJOSHADER_internal_free) ? NULL : ctx->free;
  2463     retval->malloc_data = ctx->malloc_data;
  2463     retval->malloc_data = ctx->malloc_data;
  2464     retval->source_profile = ctx->source_profile;
  2464     retval->source_profile = ctx->source_profile;
  2465     retval->error_count = ctx->errors->count;
  2465     retval->error_count = errorlist_count(ctx->errors);
  2466     retval->errors = errorlist_flatten(ctx->errors);
  2466     retval->errors = errorlist_flatten(ctx->errors);
  2467     retval->warning_count = ctx->warnings->count;
  2467     retval->warning_count = errorlist_count(ctx->warnings);
  2468     retval->warnings = errorlist_flatten(ctx->warnings);
  2468     retval->warnings = errorlist_flatten(ctx->warnings);
  2469 
  2469 
  2470     if (ctx->out_of_memory)  // in case something failed up there.
  2470     if (ctx->out_of_memory)  // in case something failed up there.
  2471     {
  2471     {
  2472         MOJOSHADER_freeCompileData(retval);
  2472         MOJOSHADER_freeCompileData(retval);
  2501     if (!isfail(ctx))
  2501     if (!isfail(ctx))
  2502     {
  2502     {
  2503         // !!! FIXME: build symbols and symbol_count here.
  2503         // !!! FIXME: build symbols and symbol_count here.
  2504     } // if
  2504     } // if
  2505 
  2505 
  2506     retval->error_count = ctx->errors->count;
  2506     retval->error_count = errorlist_count(ctx->errors);
  2507     retval->errors = errorlist_flatten(ctx->errors);
  2507     retval->errors = errorlist_flatten(ctx->errors);
  2508     retval->warning_count = ctx->warnings->count;
  2508     retval->warning_count = errorlist_count(ctx->warnings);
  2509     retval->warnings = errorlist_flatten(ctx->warnings);
  2509     retval->warnings = errorlist_flatten(ctx->warnings);
  2510 
  2510 
  2511     if (ctx->out_of_memory)  // in case something failed up there.
  2511     if (ctx->out_of_memory)  // in case something failed up there.
  2512     {
  2512     {
  2513         MOJOSHADER_freeCompileData(retval);
  2513         MOJOSHADER_freeCompileData(retval);