sassc 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/libsass/.gitignore +6 -0
- data/ext/libsass/.travis.yml +5 -1
- data/ext/libsass/Makefile +12 -3
- data/ext/libsass/Makefile.am +16 -28
- data/ext/libsass/Readme.md +1 -0
- data/ext/libsass/appveyor.yml +1 -2
- data/ext/libsass/ast.cpp +9 -0
- data/ext/libsass/ast.hpp +152 -55
- data/ext/libsass/ast_factory.hpp +2 -0
- data/ext/libsass/ast_fwd_decl.hpp +1 -0
- data/ext/libsass/backtrace.hpp +2 -2
- data/ext/libsass/bind.cpp +15 -13
- data/ext/libsass/configure.ac +17 -5
- data/ext/libsass/constants.cpp +22 -2
- data/ext/libsass/constants.hpp +21 -2
- data/ext/libsass/context.cpp +79 -57
- data/ext/libsass/context.hpp +23 -9
- data/ext/libsass/contextualize.cpp +2 -28
- data/ext/libsass/contextualize.hpp +6 -10
- data/ext/libsass/contextualize_eval.cpp +93 -0
- data/ext/libsass/contextualize_eval.hpp +44 -0
- data/ext/libsass/contrib/plugin.cpp +57 -0
- data/ext/libsass/cssize.cpp +3 -1
- data/ext/libsass/debugger.hpp +242 -83
- data/ext/libsass/emitter.cpp +1 -1
- data/ext/libsass/emitter.hpp +1 -1
- data/ext/libsass/environment.hpp +109 -25
- data/ext/libsass/error_handling.cpp +3 -3
- data/ext/libsass/error_handling.hpp +0 -1
- data/ext/libsass/eval.cpp +145 -61
- data/ext/libsass/eval.hpp +9 -1
- data/ext/libsass/expand.cpp +134 -60
- data/ext/libsass/expand.hpp +5 -2
- data/ext/libsass/extend.cpp +7 -5
- data/ext/libsass/file.cpp +176 -123
- data/ext/libsass/file.hpp +44 -7
- data/ext/libsass/functions.cpp +36 -17
- data/ext/libsass/functions.hpp +2 -2
- data/ext/libsass/inspect.cpp +23 -14
- data/ext/libsass/inspect.hpp +1 -0
- data/ext/libsass/json.cpp +132 -135
- data/ext/libsass/lexer.cpp +133 -0
- data/ext/libsass/lexer.hpp +239 -0
- data/ext/libsass/listize.cpp +83 -0
- data/ext/libsass/listize.hpp +41 -0
- data/ext/libsass/operation.hpp +2 -0
- data/ext/libsass/output.cpp +5 -6
- data/ext/libsass/parser.cpp +426 -388
- data/ext/libsass/parser.hpp +97 -109
- data/ext/libsass/plugins.cpp +15 -2
- data/ext/libsass/plugins.hpp +6 -4
- data/ext/libsass/position.cpp +52 -17
- data/ext/libsass/position.hpp +19 -17
- data/ext/libsass/prelexer.cpp +202 -235
- data/ext/libsass/prelexer.hpp +73 -333
- data/ext/libsass/sass.cpp +21 -11
- data/ext/libsass/sass.h +6 -6
- data/ext/libsass/sass_context.cpp +167 -81
- data/ext/libsass/sass_context.h +26 -6
- data/ext/libsass/sass_functions.cpp +49 -40
- data/ext/libsass/sass_functions.h +55 -43
- data/ext/libsass/sass_interface.cpp +9 -8
- data/ext/libsass/sass_interface.h +3 -3
- data/ext/libsass/sass_version.h +8 -0
- data/ext/libsass/sass_version.h.in +8 -0
- data/ext/libsass/script/ci-build-libsass +3 -3
- data/ext/libsass/script/ci-report-coverage +2 -1
- data/ext/libsass/source_map.cpp +2 -2
- data/ext/libsass/util.cpp +60 -11
- data/ext/libsass/util.hpp +6 -1
- data/ext/libsass/win/libsass.filters +12 -0
- data/ext/libsass/win/libsass.vcxproj +10 -0
- data/lib/sassc.rb +3 -1
- data/lib/sassc/cache_stores/base.rb +2 -0
- data/lib/sassc/dependency.rb +3 -1
- data/lib/sassc/engine.rb +31 -16
- data/lib/sassc/error.rb +3 -2
- data/lib/sassc/functions_handler.rb +54 -0
- data/lib/sassc/import_handler.rb +41 -0
- data/lib/sassc/importer.rb +4 -31
- data/lib/sassc/native.rb +1 -1
- data/lib/sassc/native/native_context_api.rb +3 -2
- data/lib/sassc/script.rb +0 -51
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +1 -0
- data/test/custom_importer_test.rb +72 -69
- data/test/engine_test.rb +53 -54
- data/test/functions_test.rb +40 -39
- data/test/native_test.rb +145 -149
- data/test/output_style_test.rb +98 -0
- data/test/test_helper.rb +21 -7
- metadata +28 -2
data/ext/libsass/sass_context.h
CHANGED
@@ -14,11 +14,18 @@ extern "C" {
|
|
14
14
|
struct Sass_Compiler;
|
15
15
|
|
16
16
|
// Forward declaration
|
17
|
-
struct Sass_Options;
|
17
|
+
struct Sass_Options; // base struct
|
18
18
|
struct Sass_Context; // : Sass_Options
|
19
19
|
struct Sass_File_Context; // : Sass_Context
|
20
20
|
struct Sass_Data_Context; // : Sass_Context
|
21
21
|
|
22
|
+
// Compiler states
|
23
|
+
enum Sass_Compiler_State {
|
24
|
+
SASS_COMPILER_CREATED,
|
25
|
+
SASS_COMPILER_PARSED,
|
26
|
+
SASS_COMPILER_EXECUTED
|
27
|
+
};
|
28
|
+
|
22
29
|
// Create and initialize an option struct
|
23
30
|
ADDAPI struct Sass_Options* ADDCALL sass_make_options (void);
|
24
31
|
// Create and initialize a specific context
|
@@ -74,8 +81,9 @@ ADDAPI const char* ADDCALL sass_option_get_plugin_path (struct Sass_Options* opt
|
|
74
81
|
ADDAPI const char* ADDCALL sass_option_get_include_path (struct Sass_Options* options);
|
75
82
|
ADDAPI const char* ADDCALL sass_option_get_source_map_file (struct Sass_Options* options);
|
76
83
|
ADDAPI const char* ADDCALL sass_option_get_source_map_root (struct Sass_Options* options);
|
77
|
-
ADDAPI
|
78
|
-
ADDAPI
|
84
|
+
ADDAPI Sass_Importer_List ADDCALL sass_option_get_c_headers (struct Sass_Options* options);
|
85
|
+
ADDAPI Sass_Importer_List ADDCALL sass_option_get_c_importers (struct Sass_Options* options);
|
86
|
+
ADDAPI Sass_Function_List ADDCALL sass_option_get_c_functions (struct Sass_Options* options);
|
79
87
|
|
80
88
|
// Setters for Context_Option values
|
81
89
|
ADDAPI void ADDCALL sass_option_set_precision (struct Sass_Options* options, int precision);
|
@@ -93,8 +101,9 @@ ADDAPI void ADDCALL sass_option_set_plugin_path (struct Sass_Options* options, c
|
|
93
101
|
ADDAPI void ADDCALL sass_option_set_include_path (struct Sass_Options* options, const char* include_path);
|
94
102
|
ADDAPI void ADDCALL sass_option_set_source_map_file (struct Sass_Options* options, const char* source_map_file);
|
95
103
|
ADDAPI void ADDCALL sass_option_set_source_map_root (struct Sass_Options* options, const char* source_map_root);
|
96
|
-
ADDAPI void ADDCALL
|
97
|
-
ADDAPI void ADDCALL
|
104
|
+
ADDAPI void ADDCALL sass_option_set_c_headers (struct Sass_Options* options, Sass_Importer_List c_headers);
|
105
|
+
ADDAPI void ADDCALL sass_option_set_c_importers (struct Sass_Options* options, Sass_Importer_List c_importers);
|
106
|
+
ADDAPI void ADDCALL sass_option_set_c_functions (struct Sass_Options* options, Sass_Function_List c_functions);
|
98
107
|
|
99
108
|
|
100
109
|
// Getters for Sass_Context values
|
@@ -104,11 +113,15 @@ ADDAPI const char* ADDCALL sass_context_get_error_json (struct Sass_Context* ctx
|
|
104
113
|
ADDAPI const char* ADDCALL sass_context_get_error_text (struct Sass_Context* ctx);
|
105
114
|
ADDAPI const char* ADDCALL sass_context_get_error_message (struct Sass_Context* ctx);
|
106
115
|
ADDAPI const char* ADDCALL sass_context_get_error_file (struct Sass_Context* ctx);
|
116
|
+
ADDAPI const char* ADDCALL sass_context_get_error_src (struct Sass_Context* ctx);
|
107
117
|
ADDAPI size_t ADDCALL sass_context_get_error_line (struct Sass_Context* ctx);
|
108
118
|
ADDAPI size_t ADDCALL sass_context_get_error_column (struct Sass_Context* ctx);
|
109
119
|
ADDAPI const char* ADDCALL sass_context_get_source_map_string (struct Sass_Context* ctx);
|
110
120
|
ADDAPI char** ADDCALL sass_context_get_included_files (struct Sass_Context* ctx);
|
111
121
|
|
122
|
+
// Calculate the size of the stored null terminated array
|
123
|
+
ADDAPI size_t ADDCALL sass_context_get_included_files_size (struct Sass_Context* ctx);
|
124
|
+
|
112
125
|
// Take ownership of memory (value on context is set to 0)
|
113
126
|
ADDAPI char* ADDCALL sass_context_take_error_json (struct Sass_Context* ctx);
|
114
127
|
ADDAPI char* ADDCALL sass_context_take_error_text (struct Sass_Context* ctx);
|
@@ -116,12 +129,19 @@ ADDAPI char* ADDCALL sass_context_take_error_message (struct Sass_Context* ctx);
|
|
116
129
|
ADDAPI char* ADDCALL sass_context_take_error_file (struct Sass_Context* ctx);
|
117
130
|
ADDAPI char* ADDCALL sass_context_take_output_string (struct Sass_Context* ctx);
|
118
131
|
ADDAPI char* ADDCALL sass_context_take_source_map_string (struct Sass_Context* ctx);
|
132
|
+
ADDAPI char** ADDCALL sass_context_take_included_files (struct Sass_Context* ctx);
|
133
|
+
|
134
|
+
// Getters for Sass_Compiler options
|
135
|
+
ADDAPI enum Sass_Compiler_State ADDCALL sass_compiler_get_state(struct Sass_Compiler* compiler);
|
136
|
+
ADDAPI struct Sass_Context* ADDCALL sass_compiler_get_context(struct Sass_Compiler* compiler);
|
137
|
+
ADDAPI size_t ADDCALL sass_compiler_get_import_stack_size(struct Sass_Compiler* compiler);
|
138
|
+
ADDAPI Sass_Import_Entry ADDCALL sass_compiler_get_last_import(struct Sass_Compiler* compiler);
|
139
|
+
ADDAPI Sass_Import_Entry ADDCALL sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx);
|
119
140
|
|
120
141
|
// Push function for paths (no manipulation support for now)
|
121
142
|
ADDAPI void ADDCALL sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
|
122
143
|
ADDAPI void ADDCALL sass_option_push_include_path (struct Sass_Options* options, const char* path);
|
123
144
|
|
124
|
-
|
125
145
|
#ifdef __cplusplus
|
126
146
|
} // __cplusplus defined.
|
127
147
|
#endif
|
@@ -14,20 +14,20 @@ extern "C" {
|
|
14
14
|
using namespace Sass;
|
15
15
|
|
16
16
|
// Struct to hold custom function callback
|
17
|
-
struct
|
18
|
-
const char*
|
19
|
-
|
20
|
-
void*
|
17
|
+
struct Sass_Function {
|
18
|
+
const char* signature;
|
19
|
+
Sass_Function_Fn function;
|
20
|
+
void* cookie;
|
21
21
|
};
|
22
22
|
|
23
|
-
|
23
|
+
Sass_Function_List ADDCALL sass_make_function_list(size_t length)
|
24
24
|
{
|
25
|
-
return (
|
25
|
+
return (Sass_Function_List) calloc(length + 1, sizeof(Sass_Function_Entry));
|
26
26
|
}
|
27
27
|
|
28
|
-
|
28
|
+
Sass_Function_Entry ADDCALL sass_make_function(const char* signature, Sass_Function_Fn function, void* cookie)
|
29
29
|
{
|
30
|
-
|
30
|
+
Sass_Function_Entry cb = (Sass_Function_Entry) calloc(1, sizeof(Sass_Function));
|
31
31
|
if (cb == 0) return 0;
|
32
32
|
cb->signature = signature;
|
33
33
|
cb->function = function;
|
@@ -36,12 +36,12 @@ extern "C" {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
// Setters and getters for callbacks on function lists
|
39
|
-
|
40
|
-
void sass_function_set_list_entry(
|
39
|
+
Sass_Function_Entry ADDCALL sass_function_get_list_entry(Sass_Function_List list, size_t pos) { return list[pos]; }
|
40
|
+
void sass_function_set_list_entry(Sass_Function_List list, size_t pos, Sass_Function_Entry cb) { list[pos] = cb; }
|
41
41
|
|
42
|
-
const char* ADDCALL sass_function_get_signature(
|
43
|
-
|
44
|
-
void* ADDCALL sass_function_get_cookie(
|
42
|
+
const char* ADDCALL sass_function_get_signature(Sass_Function_Entry cb) { return cb->signature; }
|
43
|
+
Sass_Function_Fn ADDCALL sass_function_get_function(Sass_Function_Entry cb) { return cb->function; }
|
44
|
+
void* ADDCALL sass_function_get_cookie(Sass_Function_Entry cb) { return cb->cookie; }
|
45
45
|
|
46
46
|
// External import entry
|
47
47
|
struct Sass_Import {
|
@@ -56,38 +56,47 @@ extern "C" {
|
|
56
56
|
};
|
57
57
|
|
58
58
|
// Struct to hold importer callback
|
59
|
-
struct
|
60
|
-
|
59
|
+
struct Sass_Importer {
|
60
|
+
Sass_Importer_Fn importer;
|
61
|
+
double priority;
|
61
62
|
void* cookie;
|
62
63
|
};
|
63
64
|
|
64
|
-
|
65
|
+
Sass_Importer_Entry ADDCALL sass_make_importer(Sass_Importer_Fn importer, double priority, void* cookie)
|
65
66
|
{
|
66
|
-
|
67
|
+
Sass_Importer_Entry cb = (Sass_Importer_Entry) calloc(1, sizeof(Sass_Importer));
|
67
68
|
if (cb == 0) return 0;
|
68
|
-
cb->
|
69
|
+
cb->importer = importer;
|
70
|
+
cb->priority = priority;
|
69
71
|
cb->cookie = cookie;
|
70
72
|
return cb;
|
71
73
|
}
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
+
Sass_Importer_Fn ADDCALL sass_importer_get_function(Sass_Importer_Entry cb) { return cb->importer; }
|
76
|
+
double ADDCALL sass_importer_get_priority (Sass_Importer_Entry cb) { return cb->priority; }
|
77
|
+
void* ADDCALL sass_importer_get_cookie(Sass_Importer_Entry cb) { return cb->cookie; }
|
75
78
|
|
76
79
|
// Just in case we have some stray import structs
|
77
|
-
void ADDCALL sass_delete_importer (
|
80
|
+
void ADDCALL sass_delete_importer (Sass_Importer_Entry cb)
|
81
|
+
{
|
82
|
+
free(cb);
|
83
|
+
}
|
84
|
+
|
85
|
+
// Creator for sass custom importer function list
|
86
|
+
Sass_Importer_List ADDCALL sass_make_importer_list(size_t length)
|
78
87
|
{
|
79
|
-
|
88
|
+
return (Sass_Importer_List) calloc(length + 1, sizeof(Sass_Importer_Entry));
|
80
89
|
}
|
81
90
|
|
82
91
|
// Creator for sass custom importer return argument list
|
83
|
-
|
92
|
+
Sass_Import_List ADDCALL sass_make_import_list(size_t length)
|
84
93
|
{
|
85
94
|
return (Sass_Import**) calloc(length + 1, sizeof(Sass_Import*));
|
86
95
|
}
|
87
96
|
|
88
97
|
// Creator for a single import entry returned by the custom importer inside the list
|
89
98
|
// We take ownership of the memory for source and srcmap (freed when context is destroyd)
|
90
|
-
|
99
|
+
Sass_Import_Entry ADDCALL sass_make_import(const char* path, const char* base, char* source, char* srcmap)
|
91
100
|
{
|
92
101
|
Sass_Import* v = (Sass_Import*) calloc(1, sizeof(Sass_Import));
|
93
102
|
if (v == 0) return 0;
|
@@ -102,13 +111,13 @@ extern "C" {
|
|
102
111
|
}
|
103
112
|
|
104
113
|
// Older style, but somehow still valid - keep around or deprecate?
|
105
|
-
|
114
|
+
Sass_Import_Entry ADDCALL sass_make_import_entry(const char* path, char* source, char* srcmap)
|
106
115
|
{
|
107
116
|
return sass_make_import(path, path, source, srcmap);
|
108
117
|
}
|
109
118
|
|
110
119
|
// Upgrade a normal import entry to throw an error (original path can be re-used by error reporting)
|
111
|
-
|
120
|
+
Sass_Import_Entry ADDCALL sass_import_set_error(Sass_Import_Entry import, const char* error, size_t line, size_t col)
|
112
121
|
{
|
113
122
|
if (import == 0) return 0;
|
114
123
|
if (import->error) free(import->error);
|
@@ -119,13 +128,13 @@ extern "C" {
|
|
119
128
|
}
|
120
129
|
|
121
130
|
// Setters and getters for entries on the import list
|
122
|
-
void ADDCALL sass_import_set_list_entry(
|
123
|
-
|
131
|
+
void ADDCALL sass_import_set_list_entry(Sass_Import_List list, size_t idx, Sass_Import_Entry entry) { list[idx] = entry; }
|
132
|
+
Sass_Import_Entry ADDCALL sass_import_get_list_entry(Sass_Import_List list, size_t idx) { return list[idx]; }
|
124
133
|
|
125
134
|
// Deallocator for the allocated memory
|
126
|
-
void ADDCALL sass_delete_import_list(
|
135
|
+
void ADDCALL sass_delete_import_list(Sass_Import_List list)
|
127
136
|
{
|
128
|
-
|
137
|
+
Sass_Import_List it = list;
|
129
138
|
if (list == 0) return;
|
130
139
|
while(*list) {
|
131
140
|
sass_delete_import(*list);
|
@@ -135,7 +144,7 @@ extern "C" {
|
|
135
144
|
}
|
136
145
|
|
137
146
|
// Just in case we have some stray import structs
|
138
|
-
void ADDCALL sass_delete_import(
|
147
|
+
void ADDCALL sass_delete_import(Sass_Import_Entry import)
|
139
148
|
{
|
140
149
|
free(import->path);
|
141
150
|
free(import->base);
|
@@ -146,19 +155,19 @@ extern "C" {
|
|
146
155
|
}
|
147
156
|
|
148
157
|
// Getter for import entry
|
149
|
-
const char* ADDCALL sass_import_get_path(
|
150
|
-
const char* ADDCALL sass_import_get_base(
|
151
|
-
const char* ADDCALL sass_import_get_source(
|
152
|
-
const char* ADDCALL sass_import_get_srcmap(
|
158
|
+
const char* ADDCALL sass_import_get_path(Sass_Import_Entry entry) { return entry->path; }
|
159
|
+
const char* ADDCALL sass_import_get_base(Sass_Import_Entry entry) { return entry->base; }
|
160
|
+
const char* ADDCALL sass_import_get_source(Sass_Import_Entry entry) { return entry->source; }
|
161
|
+
const char* ADDCALL sass_import_get_srcmap(Sass_Import_Entry entry) { return entry->srcmap; }
|
153
162
|
|
154
163
|
// Getter for import error entry
|
155
|
-
size_t ADDCALL sass_import_get_error_line(
|
156
|
-
size_t ADDCALL sass_import_get_error_column(
|
157
|
-
const char* ADDCALL sass_import_get_error_message(
|
164
|
+
size_t ADDCALL sass_import_get_error_line(Sass_Import_Entry entry) { return entry->line; }
|
165
|
+
size_t ADDCALL sass_import_get_error_column(Sass_Import_Entry entry) { return entry->column; }
|
166
|
+
const char* ADDCALL sass_import_get_error_message(Sass_Import_Entry entry) { return entry->error; }
|
158
167
|
|
159
168
|
// Explicit functions to take ownership of the memory
|
160
169
|
// Resets our own property since we do not know if it is still alive
|
161
|
-
char* ADDCALL sass_import_take_source(
|
162
|
-
char* ADDCALL sass_import_take_srcmap(
|
170
|
+
char* ADDCALL sass_import_take_source(Sass_Import_Entry entry) { char* ptr = entry->source; entry->source = 0; return ptr; }
|
171
|
+
char* ADDCALL sass_import_take_srcmap(Sass_Import_Entry entry) { char* ptr = entry->srcmap; entry->srcmap = 0; return ptr; }
|
163
172
|
|
164
173
|
}
|
@@ -12,81 +12,93 @@ extern "C" {
|
|
12
12
|
|
13
13
|
// Forward declaration
|
14
14
|
struct Sass_Import;
|
15
|
+
struct Sass_Options;
|
16
|
+
struct Sass_Compiler;
|
17
|
+
struct Sass_Importer;
|
18
|
+
struct Sass_Function;
|
19
|
+
|
20
|
+
// Typedef helpers for import lists
|
21
|
+
typedef struct Sass_Import (*Sass_Import_Entry);
|
22
|
+
typedef struct Sass_Import* (*Sass_Import_List);
|
23
|
+
// Typedef helpers for custom importer lists
|
24
|
+
typedef struct Sass_Importer (*Sass_Importer_Entry);
|
25
|
+
typedef struct Sass_Importer* (*Sass_Importer_List);
|
26
|
+
// Typedef defining importer signature and return type
|
27
|
+
typedef Sass_Import_List (*Sass_Importer_Fn)
|
28
|
+
(const char* url, Sass_Importer_Entry cb, struct Sass_Compiler* compiler);
|
29
|
+
|
30
|
+
// Typedef helpers for custom functions lists
|
31
|
+
typedef struct Sass_Function (*Sass_Function_Entry);
|
32
|
+
typedef struct Sass_Function* (*Sass_Function_List);
|
33
|
+
// Typedef defining function signature and return type
|
34
|
+
typedef union Sass_Value* (*Sass_Function_Fn)
|
35
|
+
(const union Sass_Value*, Sass_Function_Entry cb, struct Sass_Options* options);
|
15
36
|
|
16
|
-
// Forward declaration
|
17
|
-
struct Sass_C_Import_Descriptor;
|
18
37
|
|
19
|
-
//
|
20
|
-
|
21
|
-
|
22
|
-
|
38
|
+
// Creator for sass custom importer return argument list
|
39
|
+
ADDAPI Sass_Importer_List ADDCALL sass_make_importer_list (size_t length);
|
40
|
+
ADDAPI Sass_Importer_Entry ADDCALL sass_importer_get_list_entry (Sass_Importer_List list, size_t idx);
|
41
|
+
ADDAPI void ADDCALL sass_importer_set_list_entry (Sass_Importer_List list, size_t idx, Sass_Importer_Entry entry);
|
42
|
+
|
23
43
|
|
24
44
|
// Creators for custom importer callback (with some additional pointer)
|
25
45
|
// The pointer is mostly used to store the callback into the actual binding
|
26
|
-
ADDAPI
|
46
|
+
ADDAPI Sass_Importer_Entry ADDCALL sass_make_importer (Sass_Importer_Fn importer, double priority, void* cookie);
|
27
47
|
|
28
48
|
// Getters for import function descriptors
|
29
|
-
ADDAPI
|
30
|
-
ADDAPI
|
49
|
+
ADDAPI Sass_Importer_Fn ADDCALL sass_importer_get_function (Sass_Importer_Entry cb);
|
50
|
+
ADDAPI double ADDCALL sass_importer_get_priority (Sass_Importer_Entry cb);
|
51
|
+
ADDAPI void* ADDCALL sass_importer_get_cookie (Sass_Importer_Entry cb);
|
31
52
|
|
32
53
|
// Deallocator for associated memory
|
33
|
-
ADDAPI void ADDCALL sass_delete_importer (
|
54
|
+
ADDAPI void ADDCALL sass_delete_importer (Sass_Importer_Entry cb);
|
34
55
|
|
35
56
|
// Creator for sass custom importer return argument list
|
36
|
-
ADDAPI
|
57
|
+
ADDAPI Sass_Import_List ADDCALL sass_make_import_list (size_t length);
|
37
58
|
// Creator for a single import entry returned by the custom importer inside the list
|
38
|
-
ADDAPI
|
39
|
-
ADDAPI
|
59
|
+
ADDAPI Sass_Import_Entry ADDCALL sass_make_import_entry (const char* path, char* source, char* srcmap);
|
60
|
+
ADDAPI Sass_Import_Entry ADDCALL sass_make_import (const char* path, const char* base, char* source, char* srcmap);
|
40
61
|
// set error message to abort import and to print out a message (path from existing object is used in output)
|
41
|
-
ADDAPI
|
62
|
+
ADDAPI Sass_Import_Entry ADDCALL sass_import_set_error(Sass_Import_Entry import, const char* message, size_t line, size_t col);
|
42
63
|
|
43
64
|
// Setters to insert an entry into the import list (you may also use [] access directly)
|
44
65
|
// Since we are dealing with pointers they should have a guaranteed and fixed size
|
45
|
-
ADDAPI void ADDCALL sass_import_set_list_entry (
|
46
|
-
ADDAPI
|
66
|
+
ADDAPI void ADDCALL sass_import_set_list_entry (Sass_Import_List list, size_t idx, Sass_Import_Entry entry);
|
67
|
+
ADDAPI Sass_Import_Entry ADDCALL sass_import_get_list_entry (Sass_Import_List list, size_t idx);
|
47
68
|
|
48
69
|
// Getters for import entry
|
49
|
-
ADDAPI const char* ADDCALL sass_import_get_path (
|
50
|
-
ADDAPI const char* ADDCALL sass_import_get_base (
|
51
|
-
ADDAPI const char* ADDCALL sass_import_get_source (
|
52
|
-
ADDAPI const char* ADDCALL sass_import_get_srcmap (
|
70
|
+
ADDAPI const char* ADDCALL sass_import_get_path (Sass_Import_Entry);
|
71
|
+
ADDAPI const char* ADDCALL sass_import_get_base (Sass_Import_Entry);
|
72
|
+
ADDAPI const char* ADDCALL sass_import_get_source (Sass_Import_Entry);
|
73
|
+
ADDAPI const char* ADDCALL sass_import_get_srcmap (Sass_Import_Entry);
|
53
74
|
// Explicit functions to take ownership of these items
|
54
75
|
// The property on our struct will be reset to NULL
|
55
|
-
ADDAPI char* ADDCALL sass_import_take_source (
|
56
|
-
ADDAPI char* ADDCALL sass_import_take_srcmap (
|
76
|
+
ADDAPI char* ADDCALL sass_import_take_source (Sass_Import_Entry);
|
77
|
+
ADDAPI char* ADDCALL sass_import_take_srcmap (Sass_Import_Entry);
|
57
78
|
// Getters from import error entry
|
58
|
-
ADDAPI size_t ADDCALL sass_import_get_error_line (
|
59
|
-
ADDAPI size_t ADDCALL sass_import_get_error_column (
|
60
|
-
ADDAPI const char* ADDCALL sass_import_get_error_message (
|
79
|
+
ADDAPI size_t ADDCALL sass_import_get_error_line (Sass_Import_Entry);
|
80
|
+
ADDAPI size_t ADDCALL sass_import_get_error_column (Sass_Import_Entry);
|
81
|
+
ADDAPI const char* ADDCALL sass_import_get_error_message (Sass_Import_Entry);
|
61
82
|
|
62
83
|
// Deallocator for associated memory (incl. entries)
|
63
|
-
ADDAPI void ADDCALL sass_delete_import_list (
|
84
|
+
ADDAPI void ADDCALL sass_delete_import_list (Sass_Import_List);
|
64
85
|
// Just in case we have some stray import structs
|
65
|
-
ADDAPI void ADDCALL sass_delete_import (
|
66
|
-
|
67
|
-
|
68
|
-
// Forward declaration
|
69
|
-
struct Sass_C_Function_Descriptor;
|
86
|
+
ADDAPI void ADDCALL sass_delete_import (Sass_Import_Entry);
|
70
87
|
|
71
|
-
// Typedef defining null terminated list of custom callbacks
|
72
|
-
typedef struct Sass_C_Function_Descriptor* (*Sass_C_Function_List);
|
73
|
-
typedef struct Sass_C_Function_Descriptor (*Sass_C_Function_Callback);
|
74
|
-
// Typedef defining custom function prototype and its return value type
|
75
|
-
typedef union Sass_Value*(*Sass_C_Function) (const union Sass_Value*, void* cookie);
|
76
88
|
|
77
89
|
|
78
90
|
// Creators for sass function list and function descriptors
|
79
|
-
ADDAPI
|
80
|
-
ADDAPI
|
91
|
+
ADDAPI Sass_Function_List ADDCALL sass_make_function_list (size_t length);
|
92
|
+
ADDAPI Sass_Function_Entry ADDCALL sass_make_function (const char* signature, Sass_Function_Fn cb, void* cookie);
|
81
93
|
|
82
94
|
// Setters and getters for callbacks on function lists
|
83
|
-
ADDAPI
|
84
|
-
ADDAPI void ADDCALL sass_function_set_list_entry(
|
95
|
+
ADDAPI Sass_Function_Entry ADDCALL sass_function_get_list_entry(Sass_Function_List list, size_t pos);
|
96
|
+
ADDAPI void ADDCALL sass_function_set_list_entry(Sass_Function_List list, size_t pos, Sass_Function_Entry cb);
|
85
97
|
|
86
98
|
// Getters for custom function descriptors
|
87
|
-
ADDAPI const char* ADDCALL sass_function_get_signature (
|
88
|
-
ADDAPI
|
89
|
-
ADDAPI void* ADDCALL sass_function_get_cookie (
|
99
|
+
ADDAPI const char* ADDCALL sass_function_get_signature (Sass_Function_Entry cb);
|
100
|
+
ADDAPI Sass_Function_Fn ADDCALL sass_function_get_function (Sass_Function_Entry cb);
|
101
|
+
ADDAPI void* ADDCALL sass_function_get_cookie (Sass_Function_Entry cb);
|
90
102
|
|
91
103
|
|
92
104
|
#ifdef __cplusplus
|
@@ -121,17 +121,16 @@ extern "C" {
|
|
121
121
|
.omit_source_map_url(c_ctx->options.omit_source_map_url)
|
122
122
|
.include_paths_c_str(c_ctx->options.include_paths)
|
123
123
|
.plugin_paths_c_str(c_ctx->options.plugin_paths)
|
124
|
-
.include_paths_array(0)
|
125
|
-
.plugin_paths_array(0)
|
124
|
+
// .include_paths_array(0)
|
125
|
+
// .plugin_paths_array(0)
|
126
126
|
.include_paths(vector<string>())
|
127
127
|
.plugin_paths(vector<string>())
|
128
128
|
.precision(c_ctx->options.precision ? c_ctx->options.precision : 5)
|
129
129
|
.indent(c_ctx->options.indent ? c_ctx->options.indent : " ")
|
130
130
|
.linefeed(c_ctx->options.linefeed ? c_ctx->options.linefeed : LFEED)
|
131
|
-
.importer(0)
|
132
131
|
);
|
133
132
|
if (c_ctx->c_functions) {
|
134
|
-
|
133
|
+
Sass_Function_List this_func_data = c_ctx->c_functions;
|
135
134
|
while ((this_func_data) && (*this_func_data)) {
|
136
135
|
cpp_ctx.c_functions.push_back(*this_func_data);
|
137
136
|
++this_func_data;
|
@@ -214,14 +213,16 @@ extern "C" {
|
|
214
213
|
.omit_source_map_url(c_ctx->options.omit_source_map_url)
|
215
214
|
.include_paths_c_str(c_ctx->options.include_paths)
|
216
215
|
.plugin_paths_c_str(c_ctx->options.plugin_paths)
|
217
|
-
.include_paths_array(0)
|
218
|
-
.plugin_paths_array(0)
|
216
|
+
// .include_paths_array(0)
|
217
|
+
// .plugin_paths_array(0)
|
219
218
|
.include_paths(vector<string>())
|
220
219
|
.plugin_paths(vector<string>())
|
221
220
|
.precision(c_ctx->options.precision ? c_ctx->options.precision : 5)
|
221
|
+
.indent(c_ctx->options.indent ? c_ctx->options.indent : " ")
|
222
|
+
.linefeed(c_ctx->options.linefeed ? c_ctx->options.linefeed : LFEED)
|
222
223
|
);
|
223
224
|
if (c_ctx->c_functions) {
|
224
|
-
|
225
|
+
Sass_Function_List this_func_data = c_ctx->c_functions;
|
225
226
|
while ((this_func_data) && (*this_func_data)) {
|
226
227
|
cpp_ctx.c_functions.push_back(*this_func_data);
|
227
228
|
++this_func_data;
|
@@ -236,7 +237,7 @@ extern "C" {
|
|
236
237
|
}
|
237
238
|
catch (Sass_Error& e) {
|
238
239
|
stringstream msg_stream;
|
239
|
-
msg_stream << e.path << ":" << e.pstate.line << ": " << e.message << endl;
|
240
|
+
msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.message << endl;
|
240
241
|
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
|
241
242
|
c_ctx->error_status = 1;
|
242
243
|
c_ctx->output_string = 0;
|
@@ -53,7 +53,7 @@ struct sass_context {
|
|
53
53
|
struct sass_options options;
|
54
54
|
int error_status;
|
55
55
|
char* error_message;
|
56
|
-
|
56
|
+
Sass_Function_List c_functions;
|
57
57
|
char** included_files;
|
58
58
|
int num_included_files;
|
59
59
|
};
|
@@ -66,7 +66,7 @@ struct sass_file_context {
|
|
66
66
|
struct sass_options options;
|
67
67
|
int error_status;
|
68
68
|
char* error_message;
|
69
|
-
|
69
|
+
Sass_Function_List c_functions;
|
70
70
|
char** included_files;
|
71
71
|
int num_included_files;
|
72
72
|
};
|
@@ -77,7 +77,7 @@ struct sass_folder_context {
|
|
77
77
|
struct sass_options options;
|
78
78
|
int error_status;
|
79
79
|
char* error_message;
|
80
|
-
|
80
|
+
Sass_Function_List c_functions;
|
81
81
|
char** included_files;
|
82
82
|
int num_included_files;
|
83
83
|
};
|