1 | #ifndef SASS_SASS_CONTEXT_H |
2 | #define SASS_SASS_CONTEXT_H |
3 | |
4 | #include "sass/base.h" |
5 | #include "sass/context.h" |
6 | #include "ast_fwd_decl.hpp" |
7 | |
8 | // sass config options structure |
9 | struct Sass_Options : Sass_Output_Options { |
10 | |
11 | // embed sourceMappingUrl as data uri |
12 | bool source_map_embed; |
13 | |
14 | // embed include contents in maps |
15 | bool source_map_contents; |
16 | |
17 | // create file urls for sources |
18 | bool source_map_file_urls; |
19 | |
20 | // Disable sourceMappingUrl in css output |
21 | bool omit_source_map_url; |
22 | |
23 | // Treat source_string as sass (as opposed to scss) |
24 | bool is_indented_syntax_src; |
25 | |
26 | // The input path is used for source map |
27 | // generation. It can be used to define |
28 | // something with string compilation or to |
29 | // overload the input file path. It is |
30 | // set to "stdin" for data contexts and |
31 | // to the input file on file contexts. |
32 | char* input_path; |
33 | |
34 | // The output path is used for source map |
35 | // generation. LibSass will not write to |
36 | // this file, it is just used to create |
37 | // information in source-maps etc. |
38 | char* output_path; |
39 | |
40 | // Colon-separated list of paths |
41 | // Semicolon-separated on Windows |
42 | // Maybe use array interface instead? |
43 | char* include_path; |
44 | char* plugin_path; |
45 | |
46 | // Include paths (linked string list) |
47 | struct string_list* include_paths; |
48 | // Plugin paths (linked string list) |
49 | struct string_list* plugin_paths; |
50 | |
51 | // Path to source map file |
52 | // Enables source map generation |
53 | // Used to create sourceMappingUrl |
54 | char* source_map_file; |
55 | |
56 | // Directly inserted in source maps |
57 | char* source_map_root; |
58 | |
59 | // Custom functions that can be called from sccs code |
60 | Sass_Function_List c_functions; |
61 | |
62 | // List of custom importers |
63 | Sass_Importer_List c_importers; |
64 | |
65 | // List of custom headers |
66 | Sass_Importer_List ; |
67 | |
68 | }; |
69 | |
70 | |
71 | // base for all contexts |
72 | struct Sass_Context : Sass_Options |
73 | { |
74 | |
75 | // store context type info |
76 | enum Sass_Input_Style type; |
77 | |
78 | // generated output data |
79 | char* output_string; |
80 | |
81 | // generated source map json |
82 | char* source_map_string; |
83 | |
84 | // error status |
85 | int error_status; |
86 | char* error_json; |
87 | char* error_text; |
88 | char* error_message; |
89 | // error position |
90 | char* error_file; |
91 | size_t error_line; |
92 | size_t error_column; |
93 | char* error_src; |
94 | |
95 | // report imported files |
96 | char** included_files; |
97 | |
98 | }; |
99 | |
100 | // struct for file compilation |
101 | struct Sass_File_Context : Sass_Context { |
102 | |
103 | // no additional fields required |
104 | // input_path is already on options |
105 | |
106 | }; |
107 | |
108 | // struct for data compilation |
109 | struct Sass_Data_Context : Sass_Context { |
110 | |
111 | // provided source string |
112 | char* source_string; |
113 | char* srcmap_string; |
114 | |
115 | }; |
116 | |
117 | // link c and cpp context |
118 | struct Sass_Compiler { |
119 | // progress status |
120 | Sass_Compiler_State state; |
121 | // original c context |
122 | Sass_Context* c_ctx; |
123 | // Sass::Context |
124 | Sass::Context* cpp_ctx; |
125 | // Sass::Block |
126 | Sass::Block_Obj root; |
127 | }; |
128 | |
129 | #endif |
130 | |