1 | #ifndef SASS_BASE_H |
2 | #define SASS_BASE_H |
3 | |
4 | // #define DEBUG |
5 | // #define DEBUG_SHARED_PTR |
6 | |
7 | #ifdef _MSC_VER |
8 | #pragma warning(disable : 4503) |
9 | #ifndef _SCL_SECURE_NO_WARNINGS |
10 | #define _SCL_SECURE_NO_WARNINGS |
11 | #endif |
12 | #ifndef _CRT_SECURE_NO_WARNINGS |
13 | #define _CRT_SECURE_NO_WARNINGS |
14 | #endif |
15 | #ifndef _CRT_NONSTDC_NO_DEPRECATE |
16 | #define _CRT_NONSTDC_NO_DEPRECATE |
17 | #endif |
18 | #endif |
19 | |
20 | // Work around lack of `noexcept` keyword support in VS2013 |
21 | #if defined(_MSC_VER) && (_MSC_VER <= 1800) && !defined(_ALLOW_KEYWORD_MACROS) |
22 | #define _ALLOW_KEYWORD_MACROS 1 |
23 | #define noexcept throw( ) |
24 | #endif |
25 | |
26 | #include <stddef.h> |
27 | #include <stdbool.h> |
28 | |
29 | #ifdef __GNUC__ |
30 | #define DEPRECATED(func) func __attribute__ ((deprecated)) |
31 | #elif defined(_MSC_VER) |
32 | #define DEPRECATED(func) __declspec(deprecated) func |
33 | #else |
34 | #pragma message("WARNING: You need to implement DEPRECATED for this compiler") |
35 | #define DEPRECATED(func) func |
36 | #endif |
37 | |
38 | #ifdef _WIN32 |
39 | |
40 | /* You should define ADD_EXPORTS *only* when building the DLL. */ |
41 | #ifdef ADD_EXPORTS |
42 | #define ADDAPI __declspec(dllexport) |
43 | #define ADDCALL __cdecl |
44 | #else |
45 | #define ADDAPI |
46 | #define ADDCALL |
47 | #endif |
48 | |
49 | #else /* _WIN32 not defined. */ |
50 | |
51 | /* Define with no value on non-Windows OSes. */ |
52 | #define ADDAPI |
53 | #define ADDCALL |
54 | |
55 | #endif |
56 | |
57 | /* Make sure functions are exported with C linkage under C++ compilers. */ |
58 | #ifdef __cplusplus |
59 | extern "C" { |
60 | #endif |
61 | |
62 | |
63 | // Different render styles |
64 | enum Sass_Output_Style { |
65 | SASS_STYLE_NESTED, |
66 | SASS_STYLE_EXPANDED, |
67 | SASS_STYLE_COMPACT, |
68 | SASS_STYLE_COMPRESSED, |
69 | // only used internaly |
70 | SASS_STYLE_INSPECT, |
71 | SASS_STYLE_TO_SASS, |
72 | SASS_STYLE_TO_CSS |
73 | }; |
74 | |
75 | // to allocate buffer to be filled |
76 | ADDAPI void* ADDCALL sass_alloc_memory(size_t size); |
77 | // to allocate a buffer from existing string |
78 | ADDAPI char* ADDCALL sass_copy_c_string(const char* str); |
79 | // to free overtaken memory when done |
80 | ADDAPI void ADDCALL sass_free_memory(void* ptr); |
81 | |
82 | // Some convenient string helper function |
83 | ADDAPI char* ADDCALL sass_string_quote (const char* str, const char quote_mark); |
84 | ADDAPI char* ADDCALL sass_string_unquote (const char* str); |
85 | |
86 | // Implemented sass language version |
87 | // Hardcoded version 3.4 for time being |
88 | ADDAPI const char* ADDCALL libsass_version(void); |
89 | |
90 | // Get compiled libsass language |
91 | ADDAPI const char* ADDCALL libsass_language_version(void); |
92 | |
93 | #ifdef __cplusplus |
94 | } // __cplusplus defined. |
95 | #endif |
96 | |
97 | #endif |
98 | |