1 | // must be the first include in all compile units |
2 | #ifndef SASS_SASS_H |
3 | #define SASS_SASS_H |
4 | |
5 | // undefine extensions macro to tell sys includes |
6 | // that we do not want any macros to be exported |
7 | // mainly fixes an issue on SmartOS (SEC macro) |
8 | #undef __EXTENSIONS__ |
9 | |
10 | #ifdef _MSC_VER |
11 | #pragma warning(disable : 4005) |
12 | #endif |
13 | |
14 | // applies to MSVC and MinGW |
15 | #ifdef _WIN32 |
16 | // we do not want the ERROR macro |
17 | # ifndef NOGDI |
18 | # define NOGDI |
19 | # endif |
20 | // we do not want the min/max macro |
21 | # ifndef NOMINMAX |
22 | # define NOMINMAX |
23 | # endif |
24 | // we do not want the IN/OUT macro |
25 | # ifndef _NO_W32_PSEUDO_MODIFIERS |
26 | # define _NO_W32_PSEUDO_MODIFIERS |
27 | # endif |
28 | #endif |
29 | |
30 | |
31 | // should we be case insensitive |
32 | // when dealing with files or paths |
33 | #ifndef FS_CASE_SENSITIVE |
34 | # ifdef _WIN32 |
35 | # define FS_CASE_SENSITIVE 0 |
36 | # else |
37 | # define FS_CASE_SENSITIVE 1 |
38 | # endif |
39 | #endif |
40 | |
41 | // path separation char |
42 | #ifndef PATH_SEP |
43 | # ifdef _WIN32 |
44 | # define PATH_SEP ';' |
45 | # else |
46 | # define PATH_SEP ':' |
47 | # endif |
48 | #endif |
49 | |
50 | |
51 | // Include C-API header |
52 | #include "sass/base.h" |
53 | |
54 | // Include allocator |
55 | #include "memory.hpp" |
56 | |
57 | // For C++ helper |
58 | #include <string> |
59 | #include <vector> |
60 | |
61 | // output behavior |
62 | namespace Sass { |
63 | |
64 | // create some C++ aliases for the most used options |
65 | const static Sass_Output_Style NESTED = SASS_STYLE_NESTED; |
66 | const static Sass_Output_Style COMPACT = SASS_STYLE_COMPACT; |
67 | const static Sass_Output_Style EXPANDED = SASS_STYLE_EXPANDED; |
68 | const static Sass_Output_Style COMPRESSED = SASS_STYLE_COMPRESSED; |
69 | // only used internal to trigger ruby inspect behavior |
70 | const static Sass_Output_Style INSPECT = SASS_STYLE_INSPECT; |
71 | const static Sass_Output_Style TO_SASS = SASS_STYLE_TO_SASS; |
72 | const static Sass_Output_Style TO_CSS = SASS_STYLE_TO_CSS; |
73 | |
74 | // helper to aid dreaded MSVC debug mode |
75 | // see implementation for more details |
76 | char* sass_copy_string(sass::string str); |
77 | |
78 | } |
79 | |
80 | // input behaviors |
81 | enum Sass_Input_Style { |
82 | SASS_CONTEXT_NULL, |
83 | SASS_CONTEXT_FILE, |
84 | SASS_CONTEXT_DATA, |
85 | SASS_CONTEXT_FOLDER |
86 | }; |
87 | |
88 | // simple linked list |
89 | struct string_list { |
90 | string_list* next; |
91 | char* string; |
92 | }; |
93 | |
94 | // sass config options structure |
95 | struct Sass_Inspect_Options { |
96 | |
97 | // Output style for the generated css code |
98 | // A value from above SASS_STYLE_* constants |
99 | enum Sass_Output_Style output_style; |
100 | |
101 | // Precision for fractional numbers |
102 | int precision; |
103 | |
104 | // initialization list (constructor with defaults) |
105 | Sass_Inspect_Options(Sass_Output_Style style = Sass::NESTED, |
106 | int precision = 10) |
107 | : output_style(style), precision(precision) |
108 | { } |
109 | |
110 | }; |
111 | |
112 | // sass config options structure |
113 | struct Sass_Output_Options : Sass_Inspect_Options { |
114 | |
115 | // String to be used for indentation |
116 | const char* indent; |
117 | // String to be used to for line feeds |
118 | const char* linefeed; |
119 | |
120 | // Emit comments in the generated CSS indicating |
121 | // the corresponding source line. |
122 | bool ; |
123 | |
124 | // initialization list (constructor with defaults) |
125 | Sass_Output_Options(struct Sass_Inspect_Options opt, |
126 | const char* indent = " " , |
127 | const char* linefeed = "\n" , |
128 | bool = false) |
129 | : Sass_Inspect_Options(opt), |
130 | indent(indent), linefeed(linefeed), |
131 | source_comments(source_comments) |
132 | { } |
133 | |
134 | // initialization list (constructor with defaults) |
135 | Sass_Output_Options(Sass_Output_Style style = Sass::NESTED, |
136 | int precision = 10, |
137 | const char* indent = " " , |
138 | const char* linefeed = "\n" , |
139 | bool = false) |
140 | : Sass_Inspect_Options(style, precision), |
141 | indent(indent), linefeed(linefeed), |
142 | source_comments(source_comments) |
143 | { } |
144 | |
145 | }; |
146 | |
147 | #endif |
148 | |