示例#1
0
  Context::Context(Context::Data initializers)
  : mem(Memory_Manager<AST_Node>()),
    source_c_str    (initializers.source_c_str()),
    sources         (vector<const char*>()),
    include_paths   (initializers.include_paths()),
    queue           (vector<pair<string, const char*> >()),
    style_sheets    (map<string, Block*>()),
    source_map(File::base_name(initializers.entry_point())),
    image_path      (initializers.image_path()),
    source_comments (initializers.source_comments()),
    source_maps     (initializers.source_maps()),
    output_style    (initializers.output_style()),
    source_map_file (initializers.source_map_file()),
    names_to_colors (map<string, Color*>()),
    colors_to_names (map<int, string>())
  {
    cwd = get_cwd();
    
    collect_include_paths(initializers.include_paths_c_str());
    collect_include_paths(initializers.include_paths_array());

    setup_color_map();

    string entry_point = initializers.entry_point();
    if (!entry_point.empty()) {
      string result(add_file(entry_point));
      if (result.empty()) {
        throw entry_point;
      }
    }
  }
示例#2
0
  Context::Context(Context::Data initializers)
  : mem(Memory_Manager<AST_Node>()),
    source_c_str         (initializers.source_c_str()),
    sources              (vector<const char*>()),
    include_paths        (initializers.include_paths()),
    queue                (vector<pair<string, const char*> >()),
    style_sheets         (map<string, Block*>()),
    source_map           (resolve_relative_path(initializers.output_path(), initializers.source_map_file(), get_cwd())),
    c_functions          (vector<Sass_C_Function_Descriptor>()),
    image_path           (initializers.image_path()),
    output_path          (make_canonical_path(initializers.output_path())),
    source_comments      (initializers.source_comments()),
    source_maps          (initializers.source_maps()),
    output_style         (initializers.output_style()),
    source_map_file      (make_canonical_path(initializers.source_map_file())),
    omit_source_map_url  (initializers.omit_source_map_url()),
    names_to_colors      (map<string, Color*>()),
    colors_to_names      (map<int, string>()),
    precision            (initializers.precision()),
    extensions           (multimap<Compound_Selector, Complex_Selector*>()),
    subset_map           (Subset_Map<string, pair<Complex_Selector*, Compound_Selector*> >())
  {
    cwd = get_cwd();

    collect_include_paths(initializers.include_paths_c_str());
    collect_include_paths(initializers.include_paths_array());

    setup_color_map();

    string entry_point = initializers.entry_point();
    if (!entry_point.empty()) {
      string result(add_file(entry_point));
      if (result.empty()) {
        throw entry_point;
      }
    }
  }