1 #include "sass_context_wrapper.h"
6 void compile_it(uv_work_t* req) {
7 sass_context_wrapper* ctx_w = (sass_context_wrapper*)req->data;
10 compile_data(ctx_w->dctx);
12 else if (ctx_w->fctx) {
13 compile_file(ctx_w->fctx);
17 void compile_data(struct Sass_Data_Context* dctx) {
18 sass_compile_data_context(dctx);
21 void compile_file(struct Sass_File_Context* fctx) {
22 sass_compile_file_context(fctx);
25 sass_context_wrapper* sass_make_context_wrapper() {
26 return (sass_context_wrapper*)calloc(1, sizeof(sass_context_wrapper));
29 void sass_free_context_wrapper(sass_context_wrapper* ctx_w) {
31 sass_delete_data_context(ctx_w->dctx);
33 else if (ctx_w->fctx) {
34 sass_delete_file_context(ctx_w->fctx);
37 delete ctx_w->error_callback;
38 delete ctx_w->success_callback;
40 ctx_w->result.Reset();
42 free(ctx_w->include_path);
43 free(ctx_w->linefeed);
44 free(ctx_w->out_file);
45 free(ctx_w->source_map);
46 free(ctx_w->source_map_root);
49 std::vector<CustomImporterBridge *>::iterator imp_it = ctx_w->importer_bridges.begin();
50 while (imp_it != ctx_w->importer_bridges.end()) {
51 CustomImporterBridge* p = *imp_it;
52 imp_it = ctx_w->importer_bridges.erase(imp_it);
55 std::vector<CustomFunctionBridge *>::iterator func_it = ctx_w->function_bridges.begin();
56 while (func_it != ctx_w->function_bridges.end()) {
57 CustomFunctionBridge* p = *func_it;
58 func_it = ctx_w->function_bridges.erase(func_it);