mojoshader_compiler.c
changeset 936 b4a15ef390c4
parent 935 bef902f8b4d9
child 937 94e50ba3f956
equal deleted inserted replaced
935:bef902f8b4d9 936:b4a15ef390c4
  2363     preprocessor_end(pp);
  2363     preprocessor_end(pp);
  2364 } // parse_source
  2364 } // parse_source
  2365 
  2365 
  2366 
  2366 
  2367 static MOJOSHADER_astData MOJOSHADER_out_of_mem_ast_data = {
  2367 static MOJOSHADER_astData MOJOSHADER_out_of_mem_ast_data = {
  2368     1, &MOJOSHADER_out_of_mem_error, 0, 0, 0, 0, 0
  2368     1, &MOJOSHADER_out_of_mem_error, 0, 0, 0, 0, 0, 0
  2369 };
  2369 };
  2370 
  2370 
  2371 // !!! FIXME: cut and paste from assembler.
  2371 // !!! FIXME: cut and paste from assembler.
  2372 // !!! FIXME: make ErrorList into something with a head/tail and count
  2372 // !!! FIXME: make ErrorList into something with a head/tail and count
  2373 // !!! FIXME:  inherent.
  2373 // !!! FIXME:  inherent.
  2456     } // if
  2456     } // if
  2457 
  2457 
  2458     retval->malloc = (ctx->malloc == MOJOSHADER_internal_malloc) ? NULL : ctx->malloc;
  2458     retval->malloc = (ctx->malloc == MOJOSHADER_internal_malloc) ? NULL : ctx->malloc;
  2459     retval->free = (ctx->free == MOJOSHADER_internal_free) ? NULL : ctx->free;
  2459     retval->free = (ctx->free == MOJOSHADER_internal_free) ? NULL : ctx->free;
  2460     retval->malloc_data = ctx->malloc_data;
  2460     retval->malloc_data = ctx->malloc_data;
       
  2461 
       
  2462     retval->strcache = ctx->strcache;
       
  2463     ctx->strcache = NULL;
  2461 
  2464 
  2462     return retval;
  2465     return retval;
  2463 } // build_astdata
  2466 } // build_astdata
  2464 
  2467 
  2465 
  2468 
  2663         ctx.malloc_data = d;
  2666         ctx.malloc_data = d;
  2664         delete_compilation_unit(&ctx,
  2667         delete_compilation_unit(&ctx,
  2665                     (MOJOSHADER_astCompilationUnit *) &data->ast->compunit);
  2668                     (MOJOSHADER_astCompilationUnit *) &data->ast->compunit);
  2666     } // if
  2669     } // if
  2667 
  2670 
       
  2671     if (data->strcache != NULL)
       
  2672         stringcache_destroy((StringCache *) data->strcache);
       
  2673 
  2668     f(data, d);
  2674     f(data, d);
  2669 } // MOJOSHADER_freeAstData
  2675 } // MOJOSHADER_freeAstData
  2670 
  2676 
  2671 
  2677 
  2672 const MOJOSHADER_compileData *MOJOSHADER_compile(const char *srcprofile,
  2678 const MOJOSHADER_compileData *MOJOSHADER_compile(const char *srcprofile,