sassc 2.0.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.gitmodules +1 -1
- data/.travis.yml +9 -3
- data/CHANGELOG.md +36 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +1 -1
- data/Rakefile +43 -7
- data/ext/depend +4 -0
- data/ext/extconf.rb +92 -0
- data/ext/libsass/VERSION +1 -0
- data/ext/libsass/include/sass/base.h +9 -1
- data/ext/libsass/include/sass/context.h +5 -1
- data/ext/libsass/src/MurmurHash2.hpp +91 -0
- data/ext/libsass/src/ast.cpp +755 -2028
- data/ext/libsass/src/ast.hpp +492 -2477
- data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
- data/ext/libsass/src/ast2c.hpp +39 -0
- data/ext/libsass/src/ast_def_macros.hpp +70 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +5 -3
- data/ext/libsass/src/ast_fwd_decl.hpp +107 -296
- data/ext/libsass/src/ast_helpers.hpp +292 -0
- data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
- data/ext/libsass/src/ast_sel_super.cpp +539 -0
- data/ext/libsass/src/ast_sel_unify.cpp +275 -0
- data/ext/libsass/src/ast_sel_weave.cpp +616 -0
- data/ext/libsass/src/ast_selectors.cpp +1043 -0
- data/ext/libsass/src/ast_selectors.hpp +522 -0
- data/ext/libsass/src/ast_supports.cpp +114 -0
- data/ext/libsass/src/ast_supports.hpp +121 -0
- data/ext/libsass/src/ast_values.cpp +1154 -0
- data/ext/libsass/src/ast_values.hpp +498 -0
- data/ext/libsass/src/backtrace.cpp +11 -7
- data/ext/libsass/src/backtrace.hpp +5 -5
- data/ext/libsass/src/base64vlq.cpp +5 -2
- data/ext/libsass/src/base64vlq.hpp +1 -1
- data/ext/libsass/src/bind.cpp +35 -34
- data/ext/libsass/src/bind.hpp +3 -1
- data/ext/libsass/src/c2ast.cpp +64 -0
- data/ext/libsass/src/c2ast.hpp +14 -0
- data/ext/libsass/src/cencode.c +4 -6
- data/ext/libsass/src/check_nesting.cpp +83 -88
- data/ext/libsass/src/check_nesting.hpp +39 -34
- data/ext/libsass/src/color_maps.cpp +168 -164
- data/ext/libsass/src/color_maps.hpp +152 -160
- data/ext/libsass/src/constants.cpp +20 -0
- data/ext/libsass/src/constants.hpp +19 -0
- data/ext/libsass/src/context.cpp +104 -121
- data/ext/libsass/src/context.hpp +43 -55
- data/ext/libsass/src/cssize.cpp +103 -188
- data/ext/libsass/src/cssize.hpp +45 -51
- data/ext/libsass/src/dart_helpers.hpp +199 -0
- data/ext/libsass/src/debugger.hpp +524 -361
- data/ext/libsass/src/emitter.cpp +26 -26
- data/ext/libsass/src/emitter.hpp +20 -18
- data/ext/libsass/src/environment.cpp +41 -27
- data/ext/libsass/src/environment.hpp +33 -22
- data/ext/libsass/src/error_handling.cpp +92 -94
- data/ext/libsass/src/error_handling.hpp +73 -50
- data/ext/libsass/src/eval.cpp +380 -515
- data/ext/libsass/src/eval.hpp +64 -57
- data/ext/libsass/src/eval_selectors.cpp +75 -0
- data/ext/libsass/src/expand.cpp +322 -263
- data/ext/libsass/src/expand.hpp +55 -39
- data/ext/libsass/src/extender.cpp +1188 -0
- data/ext/libsass/src/extender.hpp +399 -0
- data/ext/libsass/src/extension.cpp +43 -0
- data/ext/libsass/src/extension.hpp +89 -0
- data/ext/libsass/src/file.cpp +134 -88
- data/ext/libsass/src/file.hpp +28 -37
- data/ext/libsass/src/fn_colors.cpp +596 -0
- data/ext/libsass/src/fn_colors.hpp +85 -0
- data/ext/libsass/src/fn_lists.cpp +285 -0
- data/ext/libsass/src/fn_lists.hpp +34 -0
- data/ext/libsass/src/fn_maps.cpp +94 -0
- data/ext/libsass/src/fn_maps.hpp +30 -0
- data/ext/libsass/src/fn_miscs.cpp +244 -0
- data/ext/libsass/src/fn_miscs.hpp +40 -0
- data/ext/libsass/src/fn_numbers.cpp +227 -0
- data/ext/libsass/src/fn_numbers.hpp +45 -0
- data/ext/libsass/src/fn_selectors.cpp +205 -0
- data/ext/libsass/src/fn_selectors.hpp +35 -0
- data/ext/libsass/src/fn_strings.cpp +268 -0
- data/ext/libsass/src/fn_strings.hpp +34 -0
- data/ext/libsass/src/fn_utils.cpp +158 -0
- data/ext/libsass/src/fn_utils.hpp +62 -0
- data/ext/libsass/src/inspect.cpp +253 -266
- data/ext/libsass/src/inspect.hpp +72 -74
- data/ext/libsass/src/json.cpp +2 -2
- data/ext/libsass/src/lexer.cpp +25 -84
- data/ext/libsass/src/lexer.hpp +5 -16
- data/ext/libsass/src/listize.cpp +27 -43
- data/ext/libsass/src/listize.hpp +14 -11
- data/ext/libsass/src/mapping.hpp +1 -0
- data/ext/libsass/src/memory.hpp +12 -0
- data/ext/libsass/src/memory/allocator.cpp +48 -0
- data/ext/libsass/src/memory/allocator.hpp +138 -0
- data/ext/libsass/src/memory/config.hpp +20 -0
- data/ext/libsass/src/memory/memory_pool.hpp +186 -0
- data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
- data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
- data/ext/libsass/src/operation.hpp +193 -143
- data/ext/libsass/src/operators.cpp +56 -29
- data/ext/libsass/src/operators.hpp +11 -11
- data/ext/libsass/src/ordered_map.hpp +112 -0
- data/ext/libsass/src/output.cpp +59 -75
- data/ext/libsass/src/output.hpp +15 -22
- data/ext/libsass/src/parser.cpp +662 -818
- data/ext/libsass/src/parser.hpp +96 -100
- data/ext/libsass/src/parser_selectors.cpp +189 -0
- data/ext/libsass/src/permutate.hpp +164 -0
- data/ext/libsass/src/plugins.cpp +12 -8
- data/ext/libsass/src/plugins.hpp +8 -8
- data/ext/libsass/src/position.cpp +10 -26
- data/ext/libsass/src/position.hpp +44 -21
- data/ext/libsass/src/prelexer.cpp +14 -8
- data/ext/libsass/src/prelexer.hpp +9 -9
- data/ext/libsass/src/remove_placeholders.cpp +59 -57
- data/ext/libsass/src/remove_placeholders.hpp +20 -18
- data/ext/libsass/src/sass.cpp +25 -18
- data/ext/libsass/src/sass.hpp +22 -14
- data/ext/libsass/src/sass2scss.cpp +49 -18
- data/ext/libsass/src/sass_context.cpp +104 -132
- data/ext/libsass/src/sass_context.hpp +2 -2
- data/ext/libsass/src/sass_functions.cpp +7 -4
- data/ext/libsass/src/sass_functions.hpp +1 -1
- data/ext/libsass/src/sass_values.cpp +26 -21
- data/ext/libsass/src/settings.hpp +19 -0
- data/ext/libsass/src/source.cpp +69 -0
- data/ext/libsass/src/source.hpp +95 -0
- data/ext/libsass/src/source_data.hpp +32 -0
- data/ext/libsass/src/source_map.cpp +27 -20
- data/ext/libsass/src/source_map.hpp +14 -11
- data/ext/libsass/src/stylesheet.cpp +22 -0
- data/ext/libsass/src/stylesheet.hpp +57 -0
- data/ext/libsass/src/to_value.cpp +24 -22
- data/ext/libsass/src/to_value.hpp +18 -22
- data/ext/libsass/src/units.cpp +28 -22
- data/ext/libsass/src/units.hpp +9 -8
- data/ext/libsass/src/utf8/checked.h +12 -10
- data/ext/libsass/src/utf8/core.h +3 -0
- data/ext/libsass/src/utf8_string.cpp +12 -10
- data/ext/libsass/src/utf8_string.hpp +7 -6
- data/ext/libsass/src/util.cpp +97 -107
- data/ext/libsass/src/util.hpp +74 -30
- data/ext/libsass/src/util_string.cpp +125 -0
- data/ext/libsass/src/util_string.hpp +73 -0
- data/ext/libsass/src/values.cpp +33 -24
- data/ext/libsass/src/values.hpp +2 -2
- data/lib/sassc.rb +24 -0
- data/lib/sassc/engine.rb +7 -5
- data/lib/sassc/functions_handler.rb +11 -13
- data/lib/sassc/native.rb +10 -9
- data/lib/sassc/native/native_functions_api.rb +0 -5
- data/lib/sassc/script.rb +4 -6
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +32 -12
- data/test/engine_test.rb +32 -2
- data/test/functions_test.rb +38 -1
- data/test/native_test.rb +4 -4
- metadata +95 -109
- data/ext/Rakefile +0 -3
- data/ext/libsass/.editorconfig +0 -15
- data/ext/libsass/.gitattributes +0 -2
- data/ext/libsass/.github/CONTRIBUTING.md +0 -65
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
- data/ext/libsass/.gitignore +0 -85
- data/ext/libsass/.travis.yml +0 -64
- data/ext/libsass/COPYING +0 -25
- data/ext/libsass/GNUmakefile.am +0 -88
- data/ext/libsass/INSTALL +0 -1
- data/ext/libsass/LICENSE +0 -25
- data/ext/libsass/Makefile +0 -351
- data/ext/libsass/Makefile.conf +0 -55
- data/ext/libsass/Readme.md +0 -104
- data/ext/libsass/SECURITY.md +0 -10
- data/ext/libsass/appveyor.yml +0 -91
- data/ext/libsass/configure.ac +0 -138
- data/ext/libsass/contrib/libsass.spec +0 -66
- data/ext/libsass/docs/README.md +0 -20
- data/ext/libsass/docs/api-context-example.md +0 -45
- data/ext/libsass/docs/api-context-internal.md +0 -163
- data/ext/libsass/docs/api-context.md +0 -295
- data/ext/libsass/docs/api-doc.md +0 -215
- data/ext/libsass/docs/api-function-example.md +0 -67
- data/ext/libsass/docs/api-function-internal.md +0 -8
- data/ext/libsass/docs/api-function.md +0 -74
- data/ext/libsass/docs/api-importer-example.md +0 -112
- data/ext/libsass/docs/api-importer-internal.md +0 -20
- data/ext/libsass/docs/api-importer.md +0 -86
- data/ext/libsass/docs/api-value-example.md +0 -55
- data/ext/libsass/docs/api-value-internal.md +0 -76
- data/ext/libsass/docs/api-value.md +0 -154
- data/ext/libsass/docs/build-on-darwin.md +0 -27
- data/ext/libsass/docs/build-on-gentoo.md +0 -55
- data/ext/libsass/docs/build-on-windows.md +0 -139
- data/ext/libsass/docs/build-shared-library.md +0 -35
- data/ext/libsass/docs/build-with-autotools.md +0 -78
- data/ext/libsass/docs/build-with-makefiles.md +0 -68
- data/ext/libsass/docs/build-with-mingw.md +0 -107
- data/ext/libsass/docs/build-with-visual-studio.md +0 -90
- data/ext/libsass/docs/build.md +0 -97
- data/ext/libsass/docs/compatibility-plan.md +0 -48
- data/ext/libsass/docs/contributing.md +0 -17
- data/ext/libsass/docs/custom-functions-internal.md +0 -122
- data/ext/libsass/docs/dev-ast-memory.md +0 -223
- data/ext/libsass/docs/implementations.md +0 -56
- data/ext/libsass/docs/plugins.md +0 -47
- data/ext/libsass/docs/setup-environment.md +0 -68
- data/ext/libsass/docs/source-map-internals.md +0 -51
- data/ext/libsass/docs/trace.md +0 -26
- data/ext/libsass/docs/triage.md +0 -17
- data/ext/libsass/docs/unicode.md +0 -39
- data/ext/libsass/extconf.rb +0 -6
- data/ext/libsass/include/sass/version.h.in +0 -12
- data/ext/libsass/m4/.gitkeep +0 -0
- data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +0 -167
- data/ext/libsass/res/resource.rc +0 -35
- data/ext/libsass/script/bootstrap +0 -13
- data/ext/libsass/script/branding +0 -10
- data/ext/libsass/script/ci-build-libsass +0 -134
- data/ext/libsass/script/ci-build-plugin +0 -62
- data/ext/libsass/script/ci-install-compiler +0 -6
- data/ext/libsass/script/ci-install-deps +0 -20
- data/ext/libsass/script/ci-report-coverage +0 -42
- data/ext/libsass/script/spec +0 -5
- data/ext/libsass/script/tap-driver +0 -652
- data/ext/libsass/script/tap-runner +0 -1
- data/ext/libsass/script/test-leaks.pl +0 -103
- data/ext/libsass/src/GNUmakefile.am +0 -54
- data/ext/libsass/src/extend.cpp +0 -2130
- data/ext/libsass/src/extend.hpp +0 -86
- data/ext/libsass/src/functions.cpp +0 -2234
- data/ext/libsass/src/functions.hpp +0 -198
- data/ext/libsass/src/memory/SharedPtr.cpp +0 -114
- data/ext/libsass/src/memory/SharedPtr.hpp +0 -206
- data/ext/libsass/src/node.cpp +0 -319
- data/ext/libsass/src/node.hpp +0 -118
- data/ext/libsass/src/paths.hpp +0 -71
- data/ext/libsass/src/sass_util.cpp +0 -149
- data/ext/libsass/src/sass_util.hpp +0 -256
- data/ext/libsass/src/subset_map.cpp +0 -55
- data/ext/libsass/src/subset_map.hpp +0 -76
- data/ext/libsass/src/support/libsass.pc.in +0 -11
- data/ext/libsass/src/to_c.hpp +0 -39
- data/ext/libsass/test/test_node.cpp +0 -94
- data/ext/libsass/test/test_paths.cpp +0 -28
- data/ext/libsass/test/test_selector_difference.cpp +0 -25
- data/ext/libsass/test/test_specificity.cpp +0 -25
- data/ext/libsass/test/test_subset_map.cpp +0 -472
- data/ext/libsass/test/test_superselector.cpp +0 -69
- data/ext/libsass/test/test_unification.cpp +0 -31
- data/ext/libsass/version.sh +0 -10
- data/ext/libsass/win/libsass.sln +0 -39
- data/ext/libsass/win/libsass.sln.DotSettings +0 -9
- data/ext/libsass/win/libsass.targets +0 -118
- data/ext/libsass/win/libsass.vcxproj +0 -188
- data/ext/libsass/win/libsass.vcxproj.filters +0 -357
- data/lib/sassc/native/lib_c.rb +0 -21
- data/lib/tasks/libsass.rb +0 -33
@@ -1,20 +0,0 @@
|
|
1
|
-
```C
|
2
|
-
// External import entry
|
3
|
-
struct Sass_Import {
|
4
|
-
char* imp_path; // path as found in the import statement
|
5
|
-
char *abs_path; // path after importer has resolved it
|
6
|
-
char* source;
|
7
|
-
char* srcmap;
|
8
|
-
// error handling
|
9
|
-
char* error;
|
10
|
-
size_t line;
|
11
|
-
size_t column;
|
12
|
-
};
|
13
|
-
|
14
|
-
// Struct to hold importer callback
|
15
|
-
struct Sass_Importer {
|
16
|
-
Sass_Importer_Fn importer;
|
17
|
-
double priority;
|
18
|
-
void* cookie;
|
19
|
-
};
|
20
|
-
```
|
@@ -1,86 +0,0 @@
|
|
1
|
-
By using custom importers, Sass stylesheets can be implemented in any possible way, such as by being loaded via a remote server. Please note: this feature is experimental and is implemented differently than importers in Ruby Sass. Imports must be relative to the parent import context and therefore we need to pass this information to the importer callback. This is currently done by passing the complete import string/path of the previous import context.
|
2
|
-
|
3
|
-
## Return Imports
|
4
|
-
|
5
|
-
You actually have to return a list of imports, since some importers may want to import multiple files from one import statement (ie. a glob/star importer). The memory you pass with source and srcmap is taken over by LibSass and freed automatically when the import is done. You are also allowed to return `0` instead of a list, which will tell LibSass to handle the import by itself (as if no custom importer was in use).
|
6
|
-
|
7
|
-
```C
|
8
|
-
Sass_Import_Entry* rv = sass_make_import_list(1);
|
9
|
-
rv[0] = sass_make_import(rel, abs, source, srcmap);
|
10
|
-
```
|
11
|
-
|
12
|
-
Every import will then be included in LibSass. You are allowed to only return a file path without any loaded source. This way you can ie. implement rewrite rules for import paths and leave the loading part for LibSass.
|
13
|
-
|
14
|
-
Please note that LibSass doesn't use the srcmap parameter yet. It has been added to not deprecate the C-API once support has been implemented. It will be used to re-map the actual sourcemap with the provided ones.
|
15
|
-
|
16
|
-
### Basic Usage
|
17
|
-
|
18
|
-
```C
|
19
|
-
#include "sass/functions.h"
|
20
|
-
```
|
21
|
-
|
22
|
-
## Sass Importer API
|
23
|
-
|
24
|
-
```C
|
25
|
-
// Forward declaration
|
26
|
-
struct Sass_Import;
|
27
|
-
|
28
|
-
// Forward declaration
|
29
|
-
struct Sass_C_Import_Descriptor;
|
30
|
-
|
31
|
-
// Typedef defining the custom importer callback
|
32
|
-
typedef struct Sass_C_Import_Descriptor (*Sass_C_Import_Callback);
|
33
|
-
// Typedef defining the importer c function prototype
|
34
|
-
typedef Sass_Import_Entry* (*Sass_C_Import_Fn) (const char* url, const char* prev, void* cookie);
|
35
|
-
|
36
|
-
// Creators for custom importer callback (with some additional pointer)
|
37
|
-
// The pointer is mostly used to store the callback into the actual function
|
38
|
-
Sass_C_Import_Callback sass_make_importer (Sass_C_Import_Fn, void* cookie);
|
39
|
-
|
40
|
-
// Getters for import function descriptors
|
41
|
-
Sass_C_Import_Fn sass_import_get_function (Sass_C_Import_Callback fn);
|
42
|
-
void* sass_import_get_cookie (Sass_C_Import_Callback fn);
|
43
|
-
|
44
|
-
// Deallocator for associated memory
|
45
|
-
void sass_delete_importer (Sass_C_Import_Callback fn);
|
46
|
-
|
47
|
-
// Creator for sass custom importer return argument list
|
48
|
-
Sass_Import_Entry* sass_make_import_list (size_t length);
|
49
|
-
// Creator for a single import entry returned by the custom importer inside the list
|
50
|
-
Sass_Import_Entry sass_make_import_entry (const char* path, char* source, char* srcmap);
|
51
|
-
Sass_Import_Entry sass_make_import (const char* rel, const char* abs, char* source, char* srcmap);
|
52
|
-
|
53
|
-
// set error message to abort import and to print out a message (path from existing object is used in output)
|
54
|
-
Sass_Import_Entry sass_import_set_error(Sass_Import_Entry import, const char* message, size_t line, size_t col);
|
55
|
-
|
56
|
-
// Setters to insert an entry into the import list (you may also use [] access directly)
|
57
|
-
// Since we are dealing with pointers they should have a guaranteed and fixed size
|
58
|
-
void sass_import_set_list_entry (Sass_Import_Entry* list, size_t idx, Sass_Import_Entry entry);
|
59
|
-
Sass_Import_Entry sass_import_get_list_entry (Sass_Import_Entry* list, size_t idx);
|
60
|
-
|
61
|
-
// Getters for import entry
|
62
|
-
const char* sass_import_get_imp_path (Sass_Import_Entry);
|
63
|
-
const char* sass_import_get_abs_path (Sass_Import_Entry);
|
64
|
-
const char* sass_import_get_source (Sass_Import_Entry);
|
65
|
-
const char* sass_import_get_srcmap (Sass_Import_Entry);
|
66
|
-
// Explicit functions to take ownership of these items
|
67
|
-
// The property on our struct will be reset to NULL
|
68
|
-
char* sass_import_take_source (Sass_Import_Entry);
|
69
|
-
char* sass_import_take_srcmap (Sass_Import_Entry);
|
70
|
-
|
71
|
-
// Getters for import error entries
|
72
|
-
size_t sass_import_get_error_line (Sass_Import_Entry);
|
73
|
-
size_t sass_import_get_error_column (Sass_Import_Entry);
|
74
|
-
const char* sass_import_get_error_message (Sass_Import_Entry);
|
75
|
-
|
76
|
-
// Deallocator for associated memory (incl. entries)
|
77
|
-
void sass_delete_import_list (Sass_Import_Entry*);
|
78
|
-
// Just in case we have some stray import structs
|
79
|
-
void sass_delete_import (Sass_Import_Entry);
|
80
|
-
```
|
81
|
-
|
82
|
-
### More links
|
83
|
-
|
84
|
-
- [Sass Importer Example](api-importer-example.md)
|
85
|
-
- [Sass Importer Internal](api-importer-internal.md)
|
86
|
-
|
@@ -1,55 +0,0 @@
|
|
1
|
-
## Example operation.c
|
2
|
-
|
3
|
-
```C
|
4
|
-
#include <stdio.h>
|
5
|
-
#include <string.h>
|
6
|
-
#include "sass/values.h"
|
7
|
-
|
8
|
-
int main( int argc, const char* argv[] )
|
9
|
-
{
|
10
|
-
|
11
|
-
// create two new sass values to be added
|
12
|
-
union Sass_Value* string = sass_make_string("String");
|
13
|
-
union Sass_Value* number = sass_make_number(42, "nits");
|
14
|
-
|
15
|
-
// invoke the add operation which returns a new sass value
|
16
|
-
union Sass_Value* total = sass_value_op(ADD, string, number);
|
17
|
-
|
18
|
-
// no further use for the two operands
|
19
|
-
sass_delete_value(string);
|
20
|
-
sass_delete_value(number);
|
21
|
-
|
22
|
-
// this works since libsass will always return a
|
23
|
-
// string for add operations with a string as the
|
24
|
-
// left hand side. But you should never rely on it!
|
25
|
-
puts(sass_string_get_value(total));
|
26
|
-
|
27
|
-
// invoke stringification (uncompressed with precision of 5)
|
28
|
-
union Sass_Value* result = sass_value_stringify(total, false, 5);
|
29
|
-
|
30
|
-
// no further use for the sum
|
31
|
-
sass_delete_value(total);
|
32
|
-
|
33
|
-
// print the result - you may want to make
|
34
|
-
// sure result is indeed a string, altough
|
35
|
-
// stringify guarantees to return a string
|
36
|
-
// if (sass_value_is_string(result)) {}
|
37
|
-
// really depends on your level of paranoia
|
38
|
-
puts(sass_string_get_value(result));
|
39
|
-
|
40
|
-
// finally free result
|
41
|
-
sass_delete_value(result);
|
42
|
-
|
43
|
-
// exit status
|
44
|
-
return 0;
|
45
|
-
|
46
|
-
}
|
47
|
-
```
|
48
|
-
|
49
|
-
## Compile operation.c
|
50
|
-
|
51
|
-
```bash
|
52
|
-
gcc -c operation.c -o operation.o
|
53
|
-
gcc -o operation operation.o -lsass
|
54
|
-
./operation # => String42nits
|
55
|
-
```
|
@@ -1,76 +0,0 @@
|
|
1
|
-
```C
|
2
|
-
struct Sass_Unknown {
|
3
|
-
enum Sass_Tag tag;
|
4
|
-
};
|
5
|
-
|
6
|
-
struct Sass_Boolean {
|
7
|
-
enum Sass_Tag tag;
|
8
|
-
bool value;
|
9
|
-
};
|
10
|
-
|
11
|
-
struct Sass_Number {
|
12
|
-
enum Sass_Tag tag;
|
13
|
-
double value;
|
14
|
-
char* unit;
|
15
|
-
};
|
16
|
-
|
17
|
-
struct Sass_Color {
|
18
|
-
enum Sass_Tag tag;
|
19
|
-
double r;
|
20
|
-
double g;
|
21
|
-
double b;
|
22
|
-
double a;
|
23
|
-
};
|
24
|
-
|
25
|
-
struct Sass_String {
|
26
|
-
enum Sass_Tag tag;
|
27
|
-
char* value;
|
28
|
-
};
|
29
|
-
|
30
|
-
struct Sass_List {
|
31
|
-
enum Sass_Tag tag;
|
32
|
-
enum Sass_Separator separator;
|
33
|
-
size_t length;
|
34
|
-
// null terminated "array"
|
35
|
-
union Sass_Value** values;
|
36
|
-
};
|
37
|
-
|
38
|
-
struct Sass_Map {
|
39
|
-
enum Sass_Tag tag;
|
40
|
-
size_t length;
|
41
|
-
struct Sass_MapPair* pairs;
|
42
|
-
};
|
43
|
-
|
44
|
-
struct Sass_Null {
|
45
|
-
enum Sass_Tag tag;
|
46
|
-
};
|
47
|
-
|
48
|
-
struct Sass_Error {
|
49
|
-
enum Sass_Tag tag;
|
50
|
-
char* message;
|
51
|
-
};
|
52
|
-
|
53
|
-
struct Sass_Warning {
|
54
|
-
enum Sass_Tag tag;
|
55
|
-
char* message;
|
56
|
-
};
|
57
|
-
|
58
|
-
union Sass_Value {
|
59
|
-
struct Sass_Unknown unknown;
|
60
|
-
struct Sass_Boolean boolean;
|
61
|
-
struct Sass_Number number;
|
62
|
-
struct Sass_Color color;
|
63
|
-
struct Sass_String string;
|
64
|
-
struct Sass_List list;
|
65
|
-
struct Sass_Map map;
|
66
|
-
struct Sass_Null null;
|
67
|
-
struct Sass_Error error;
|
68
|
-
struct Sass_Warning warning;
|
69
|
-
};
|
70
|
-
|
71
|
-
struct Sass_MapPair {
|
72
|
-
union Sass_Value* key;
|
73
|
-
union Sass_Value* value;
|
74
|
-
};
|
75
|
-
```
|
76
|
-
|
@@ -1,154 +0,0 @@
|
|
1
|
-
`Sass_Values` are used to pass values and their types between the implementer
|
2
|
-
and LibSass. Sass knows various different value types (including nested arrays
|
3
|
-
and hash-maps). If you implement a binding to another programming language, you
|
4
|
-
have to find a way to [marshal][1] (convert) `Sass_Values` between the target
|
5
|
-
language and C. `Sass_Values` are currently only used by custom functions, but
|
6
|
-
it should also be possible to use them without a compiler context.
|
7
|
-
|
8
|
-
[1]: https://en.wikipedia.org/wiki/Marshalling_%28computer_science%29
|
9
|
-
|
10
|
-
### Basic Usage
|
11
|
-
|
12
|
-
```C
|
13
|
-
#include "sass/values.h"
|
14
|
-
```
|
15
|
-
|
16
|
-
```C
|
17
|
-
// Type for Sass values
|
18
|
-
enum Sass_Tag {
|
19
|
-
SASS_BOOLEAN,
|
20
|
-
SASS_NUMBER,
|
21
|
-
SASS_COLOR,
|
22
|
-
SASS_STRING,
|
23
|
-
SASS_LIST,
|
24
|
-
SASS_MAP,
|
25
|
-
SASS_NULL,
|
26
|
-
SASS_ERROR,
|
27
|
-
SASS_WARNING
|
28
|
-
};
|
29
|
-
|
30
|
-
// Tags for denoting Sass list separators
|
31
|
-
enum Sass_Separator {
|
32
|
-
SASS_COMMA,
|
33
|
-
SASS_SPACE,
|
34
|
-
// only used internally to represent a hash map before evaluation
|
35
|
-
// otherwise we would be too early to check for duplicate keys
|
36
|
-
SASS_HASH
|
37
|
-
};
|
38
|
-
|
39
|
-
// Value Operators
|
40
|
-
enum Sass_OP {
|
41
|
-
AND, OR, // logical connectives
|
42
|
-
EQ, NEQ, GT, GTE, LT, LTE, // arithmetic relations
|
43
|
-
ADD, SUB, MUL, DIV, MOD, // arithmetic functions
|
44
|
-
NUM_OPS // so we know how big to make the op table
|
45
|
-
};
|
46
|
-
```
|
47
|
-
|
48
|
-
### Sass Value API
|
49
|
-
|
50
|
-
```C
|
51
|
-
// Forward declaration
|
52
|
-
union Sass_Value;
|
53
|
-
|
54
|
-
// Creator functions for all value types
|
55
|
-
union Sass_Value* sass_make_null (void);
|
56
|
-
union Sass_Value* sass_make_boolean (bool val);
|
57
|
-
union Sass_Value* sass_make_string (const char* val);
|
58
|
-
union Sass_Value* sass_make_qstring (const char* val);
|
59
|
-
union Sass_Value* sass_make_number (double val, const char* unit);
|
60
|
-
union Sass_Value* sass_make_color (double r, double g, double b, double a);
|
61
|
-
union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep, bool is_bracketed);
|
62
|
-
union Sass_Value* sass_make_map (size_t len);
|
63
|
-
union Sass_Value* sass_make_error (const char* msg);
|
64
|
-
union Sass_Value* sass_make_warning (const char* msg);
|
65
|
-
|
66
|
-
// Generic destructor function for all types
|
67
|
-
// Will release memory of all associated Sass_Values
|
68
|
-
// Means we will delete recursively for lists and maps
|
69
|
-
void sass_delete_value (union Sass_Value* val);
|
70
|
-
|
71
|
-
// Make a deep cloned copy of the given sass value
|
72
|
-
union Sass_Value* sass_clone_value (const union Sass_Value* val);
|
73
|
-
|
74
|
-
// Stringify a Sass_Values and also return the result as a Sass_Value (of type STRING)
|
75
|
-
union Sass_Value* sass_value_stringify (const union Sass_Value* a, bool compressed, int precision);
|
76
|
-
|
77
|
-
// Execute an operation for two Sass_Values and return the result as a Sass_Value too
|
78
|
-
union Sass_Value* sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b);
|
79
|
-
|
80
|
-
// Return the sass tag for a generic sass value
|
81
|
-
// Check is needed before accessing specific values!
|
82
|
-
enum Sass_Tag sass_value_get_tag (const union Sass_Value* v);
|
83
|
-
|
84
|
-
// Check value to be of a specific type
|
85
|
-
// Can also be used before accessing properties!
|
86
|
-
bool sass_value_is_null (const union Sass_Value* v);
|
87
|
-
bool sass_value_is_number (const union Sass_Value* v);
|
88
|
-
bool sass_value_is_string (const union Sass_Value* v);
|
89
|
-
bool sass_value_is_boolean (const union Sass_Value* v);
|
90
|
-
bool sass_value_is_color (const union Sass_Value* v);
|
91
|
-
bool sass_value_is_list (const union Sass_Value* v);
|
92
|
-
bool sass_value_is_map (const union Sass_Value* v);
|
93
|
-
bool sass_value_is_error (const union Sass_Value* v);
|
94
|
-
bool sass_value_is_warning (const union Sass_Value* v);
|
95
|
-
|
96
|
-
// Getters and setters for Sass_Number
|
97
|
-
double sass_number_get_value (const union Sass_Value* v);
|
98
|
-
void sass_number_set_value (union Sass_Value* v, double value);
|
99
|
-
const char* sass_number_get_unit (const union Sass_Value* v);
|
100
|
-
void sass_number_set_unit (union Sass_Value* v, char* unit);
|
101
|
-
|
102
|
-
// Getters and setters for Sass_String
|
103
|
-
const char* sass_string_get_value (const union Sass_Value* v);
|
104
|
-
void sass_string_set_value (union Sass_Value* v, char* value);
|
105
|
-
bool sass_string_is_quoted(const union Sass_Value* v);
|
106
|
-
void sass_string_set_quoted(union Sass_Value* v, bool quoted);
|
107
|
-
|
108
|
-
// Getters and setters for Sass_Boolean
|
109
|
-
bool sass_boolean_get_value (const union Sass_Value* v);
|
110
|
-
void sass_boolean_set_value (union Sass_Value* v, bool value);
|
111
|
-
|
112
|
-
// Getters and setters for Sass_Color
|
113
|
-
double sass_color_get_r (const union Sass_Value* v);
|
114
|
-
void sass_color_set_r (union Sass_Value* v, double r);
|
115
|
-
double sass_color_get_g (const union Sass_Value* v);
|
116
|
-
void sass_color_set_g (union Sass_Value* v, double g);
|
117
|
-
double sass_color_get_b (const union Sass_Value* v);
|
118
|
-
void sass_color_set_b (union Sass_Value* v, double b);
|
119
|
-
double sass_color_get_a (const union Sass_Value* v);
|
120
|
-
void sass_color_set_a (union Sass_Value* v, double a);
|
121
|
-
|
122
|
-
// Getter for the number of items in list
|
123
|
-
size_t sass_list_get_length (const union Sass_Value* v);
|
124
|
-
// Getters and setters for Sass_List
|
125
|
-
enum Sass_Separator sass_list_get_separator (const union Sass_Value* v);
|
126
|
-
void sass_list_set_separator (union Sass_Value* v, enum Sass_Separator value);
|
127
|
-
bool sass_list_get_is_bracketed (const union Sass_Value* v);
|
128
|
-
void sass_list_set_is_bracketed (union Sass_Value* v, bool value);
|
129
|
-
// Getters and setters for Sass_List values
|
130
|
-
union Sass_Value* sass_list_get_value (const union Sass_Value* v, size_t i);
|
131
|
-
void sass_list_set_value (union Sass_Value* v, size_t i, union Sass_Value* value);
|
132
|
-
|
133
|
-
// Getter for the number of items in map
|
134
|
-
size_t sass_map_get_length (const union Sass_Value* v);
|
135
|
-
// Getters and setters for Sass_Map keys and values
|
136
|
-
union Sass_Value* sass_map_get_key (const union Sass_Value* v, size_t i);
|
137
|
-
void sass_map_set_key (union Sass_Value* v, size_t i, union Sass_Value*);
|
138
|
-
union Sass_Value* sass_map_get_value (const union Sass_Value* v, size_t i);
|
139
|
-
void sass_map_set_value (union Sass_Value* v, size_t i, union Sass_Value*);
|
140
|
-
|
141
|
-
// Getters and setters for Sass_Error
|
142
|
-
char* sass_error_get_message (const union Sass_Value* v);
|
143
|
-
void sass_error_set_message (union Sass_Value* v, char* msg);
|
144
|
-
|
145
|
-
// Getters and setters for Sass_Warning
|
146
|
-
char* sass_warning_get_message (const union Sass_Value* v);
|
147
|
-
void sass_warning_set_message (union Sass_Value* v, char* msg);
|
148
|
-
```
|
149
|
-
|
150
|
-
### More links
|
151
|
-
|
152
|
-
- [Sass Value Example](api-value-example.md)
|
153
|
-
- [Sass Value Internal](api-value-internal.md)
|
154
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
To install LibSass, make sure the OS X build tools are installed:
|
2
|
-
|
3
|
-
xcode-select --install
|
4
|
-
|
5
|
-
## Homebrew
|
6
|
-
|
7
|
-
To install homebrew, see [http://brew.sh](http://brew.sh)
|
8
|
-
|
9
|
-
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
10
|
-
|
11
|
-
You can install the latest version of LibSass quite easily with brew.
|
12
|
-
|
13
|
-
brew install --HEAD libsass
|
14
|
-
|
15
|
-
To update this, do:
|
16
|
-
|
17
|
-
brew reinstall --HEAD libsass
|
18
|
-
|
19
|
-
Brew will build static and shared libraries, and a `libsass.pc` file in `/usr/local/lib/pkgconfig`.
|
20
|
-
|
21
|
-
To use `libsass.pc`, make sure this path is in your `PKG_CONFIG_PATH`
|
22
|
-
|
23
|
-
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
24
|
-
|
25
|
-
## Manually
|
26
|
-
|
27
|
-
See the linux instructions [Building-with-autotools](build-with-autotools.md) or [Building-with-makefiles](build-with-makefiles.md)
|
@@ -1,55 +0,0 @@
|
|
1
|
-
Here are two ebuilds to compile LibSass and sassc on gentoo linux. If you do not know how to use these ebuilds, you should probably read the gentoo wiki page about [portage overlays](http://wiki.gentoo.org/wiki/Overlay).
|
2
|
-
|
3
|
-
## www-misc/libsass/libsass-9999.ebuild
|
4
|
-
```ebuild
|
5
|
-
EAPI=4
|
6
|
-
|
7
|
-
inherit eutils git-2 autotools
|
8
|
-
|
9
|
-
DESCRIPTION="A C/C++ implementation of a Sass compiler."
|
10
|
-
HOMEPAGE="http://libsass.org/"
|
11
|
-
EGIT_PROJECT='libsass'
|
12
|
-
EGIT_REPO_URI="https://github.com/sass/libsass.git"
|
13
|
-
LICENSE="MIT"
|
14
|
-
SLOT="0"
|
15
|
-
KEYWORDS=""
|
16
|
-
IUSE=""
|
17
|
-
DEPEND=""
|
18
|
-
RDEPEND="${DEPEND}"
|
19
|
-
DEPEND="${DEPEND}"
|
20
|
-
|
21
|
-
pkg_pretend() {
|
22
|
-
# older gcc is not supported
|
23
|
-
local major=$(gcc-major-version)
|
24
|
-
local minor=$(gcc-minor-version)
|
25
|
-
[[ "${MERGE_TYPE}" != "binary" && ( $major > 4 || ( $major == 4 && $minor < 5 ) ) ]] && \
|
26
|
-
die "Sorry, but gcc earlier than 4.5 will not work for LibSass."
|
27
|
-
}
|
28
|
-
|
29
|
-
src_prepare() {
|
30
|
-
eautoreconf
|
31
|
-
}
|
32
|
-
```
|
33
|
-
|
34
|
-
## www-misc/sassc/sassc-9999.ebuild
|
35
|
-
```ebuild
|
36
|
-
EAPI=4
|
37
|
-
|
38
|
-
inherit eutils git-2 autotools
|
39
|
-
|
40
|
-
DESCRIPTION="Command Line Tool for LibSass."
|
41
|
-
HOMEPAGE="http://libsass.org/"
|
42
|
-
EGIT_PROJECT='sassc'
|
43
|
-
EGIT_REPO_URI="https://github.com/sass/sassc.git"
|
44
|
-
LICENSE="MIT"
|
45
|
-
SLOT="0"
|
46
|
-
KEYWORDS=""
|
47
|
-
IUSE=""
|
48
|
-
DEPEND="www-misc/libsass"
|
49
|
-
RDEPEND="${DEPEND}"
|
50
|
-
DEPEND="${DEPEND}"
|
51
|
-
|
52
|
-
src_prepare() {
|
53
|
-
eautoreconf
|
54
|
-
}
|
55
|
-
```
|