sassc 1.11.4 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -2
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/README.md +4 -1
  5. data/ext/libsass/.editorconfig +1 -1
  6. data/ext/libsass/.github/CONTRIBUTING.md +7 -7
  7. data/ext/libsass/.github/ISSUE_TEMPLATE.md +31 -6
  8. data/ext/libsass/.gitignore +3 -0
  9. data/ext/libsass/.travis.yml +37 -18
  10. data/ext/libsass/GNUmakefile.am +23 -37
  11. data/ext/libsass/Makefile +10 -6
  12. data/ext/libsass/Makefile.conf +3 -0
  13. data/ext/libsass/Readme.md +68 -63
  14. data/ext/libsass/appveyor.yml +7 -3
  15. data/ext/libsass/configure.ac +10 -14
  16. data/ext/libsass/docs/api-context-internal.md +29 -21
  17. data/ext/libsass/docs/api-context.md +26 -6
  18. data/ext/libsass/docs/api-doc.md +49 -16
  19. data/ext/libsass/docs/api-function-example.md +1 -1
  20. data/ext/libsass/docs/api-function.md +31 -7
  21. data/ext/libsass/docs/api-importer.md +19 -19
  22. data/ext/libsass/docs/api-value.md +4 -2
  23. data/ext/libsass/docs/build-on-windows.md +4 -4
  24. data/ext/libsass/docs/build-with-mingw.md +3 -3
  25. data/ext/libsass/docs/build.md +9 -9
  26. data/ext/libsass/docs/custom-functions-internal.md +10 -8
  27. data/ext/libsass/docs/implementations.md +20 -8
  28. data/ext/libsass/docs/unicode.md +16 -10
  29. data/ext/libsass/include/sass/base.h +0 -3
  30. data/ext/libsass/include/sass/context.h +20 -2
  31. data/ext/libsass/include/sass/functions.h +31 -0
  32. data/ext/libsass/include/sass/values.h +3 -1
  33. data/ext/libsass/include/sass/version.h +1 -1
  34. data/ext/libsass/include/sass/version.h.in +1 -1
  35. data/ext/libsass/include/sass2scss.h +1 -1
  36. data/ext/libsass/res/resource.rc +6 -6
  37. data/ext/libsass/script/ci-build-libsass +10 -5
  38. data/ext/libsass/script/ci-build-plugin +62 -0
  39. data/ext/libsass/script/ci-install-compiler +1 -1
  40. data/ext/libsass/script/ci-install-deps +4 -7
  41. data/ext/libsass/script/ci-report-coverage +13 -3
  42. data/ext/libsass/script/tap-driver +1 -1
  43. data/ext/libsass/script/tap-runner +1 -1
  44. data/ext/libsass/src/GNUmakefile.am +1 -1
  45. data/ext/libsass/src/ast.cpp +537 -762
  46. data/ext/libsass/src/ast.hpp +377 -419
  47. data/ext/libsass/src/ast_def_macros.hpp +26 -1
  48. data/ext/libsass/src/ast_fwd_decl.cpp +29 -0
  49. data/ext/libsass/src/ast_fwd_decl.hpp +94 -21
  50. data/ext/libsass/src/b64/encode.h +3 -1
  51. data/ext/libsass/src/backtrace.cpp +46 -0
  52. data/ext/libsass/src/backtrace.hpp +7 -54
  53. data/ext/libsass/src/bind.cpp +72 -50
  54. data/ext/libsass/src/bind.hpp +0 -1
  55. data/ext/libsass/src/cencode.c +6 -0
  56. data/ext/libsass/src/check_nesting.cpp +157 -135
  57. data/ext/libsass/src/check_nesting.hpp +11 -10
  58. data/ext/libsass/src/color_maps.cpp +10 -6
  59. data/ext/libsass/src/color_maps.hpp +6 -8
  60. data/ext/libsass/src/constants.cpp +4 -3
  61. data/ext/libsass/src/constants.hpp +4 -3
  62. data/ext/libsass/src/context.cpp +110 -47
  63. data/ext/libsass/src/context.hpp +11 -1
  64. data/ext/libsass/src/cssize.cpp +105 -94
  65. data/ext/libsass/src/cssize.hpp +4 -5
  66. data/ext/libsass/src/debugger.hpp +247 -244
  67. data/ext/libsass/src/emitter.cpp +30 -6
  68. data/ext/libsass/src/emitter.hpp +7 -0
  69. data/ext/libsass/src/environment.cpp +67 -16
  70. data/ext/libsass/src/environment.hpp +28 -7
  71. data/ext/libsass/src/error_handling.cpp +92 -64
  72. data/ext/libsass/src/error_handling.hpp +64 -43
  73. data/ext/libsass/src/eval.cpp +494 -544
  74. data/ext/libsass/src/eval.hpp +17 -23
  75. data/ext/libsass/src/expand.cpp +182 -154
  76. data/ext/libsass/src/expand.hpp +4 -5
  77. data/ext/libsass/src/extend.cpp +299 -291
  78. data/ext/libsass/src/extend.hpp +46 -11
  79. data/ext/libsass/src/file.cpp +103 -36
  80. data/ext/libsass/src/file.hpp +21 -4
  81. data/ext/libsass/src/functions.cpp +561 -312
  82. data/ext/libsass/src/functions.hpp +8 -5
  83. data/ext/libsass/src/inspect.cpp +108 -53
  84. data/ext/libsass/src/inspect.hpp +5 -2
  85. data/ext/libsass/src/lexer.cpp +15 -7
  86. data/ext/libsass/src/lexer.hpp +13 -4
  87. data/ext/libsass/src/listize.cpp +3 -2
  88. data/ext/libsass/src/listize.hpp +0 -1
  89. data/ext/libsass/src/memory/SharedPtr.cpp +16 -18
  90. data/ext/libsass/src/memory/SharedPtr.hpp +47 -43
  91. data/ext/libsass/src/node.cpp +34 -38
  92. data/ext/libsass/src/node.hpp +6 -8
  93. data/ext/libsass/src/operation.hpp +2 -2
  94. data/ext/libsass/src/operators.cpp +240 -0
  95. data/ext/libsass/src/operators.hpp +30 -0
  96. data/ext/libsass/src/output.cpp +22 -20
  97. data/ext/libsass/src/parser.cpp +719 -358
  98. data/ext/libsass/src/parser.hpp +57 -22
  99. data/ext/libsass/src/plugins.cpp +28 -10
  100. data/ext/libsass/src/position.cpp +21 -3
  101. data/ext/libsass/src/position.hpp +2 -1
  102. data/ext/libsass/src/prelexer.cpp +104 -19
  103. data/ext/libsass/src/prelexer.hpp +10 -3
  104. data/ext/libsass/src/remove_placeholders.cpp +9 -10
  105. data/ext/libsass/src/remove_placeholders.hpp +1 -5
  106. data/ext/libsass/src/sass.cpp +62 -4
  107. data/ext/libsass/src/sass.hpp +5 -2
  108. data/ext/libsass/src/sass_context.cpp +96 -58
  109. data/ext/libsass/src/sass_context.hpp +7 -5
  110. data/ext/libsass/src/sass_functions.cpp +63 -1
  111. data/ext/libsass/src/sass_functions.hpp +19 -1
  112. data/ext/libsass/src/sass_util.cpp +3 -3
  113. data/ext/libsass/src/sass_util.hpp +4 -4
  114. data/ext/libsass/src/sass_values.cpp +42 -39
  115. data/ext/libsass/src/sass_values.hpp +2 -1
  116. data/ext/libsass/src/source_map.cpp +16 -18
  117. data/ext/libsass/src/subset_map.cpp +6 -8
  118. data/ext/libsass/src/subset_map.hpp +6 -6
  119. data/ext/libsass/src/to_c.cpp +2 -2
  120. data/ext/libsass/src/to_value.cpp +8 -3
  121. data/ext/libsass/src/to_value.hpp +1 -0
  122. data/ext/libsass/src/units.cpp +349 -45
  123. data/ext/libsass/src/units.hpp +39 -22
  124. data/ext/libsass/src/utf8/checked.h +7 -0
  125. data/ext/libsass/src/utf8/unchecked.h +7 -0
  126. data/ext/libsass/src/utf8_string.cpp +1 -1
  127. data/ext/libsass/src/util.cpp +139 -45
  128. data/ext/libsass/src/util.hpp +4 -7
  129. data/ext/libsass/src/values.cpp +15 -23
  130. data/ext/libsass/win/libsass.sln +13 -2
  131. data/ext/libsass/win/libsass.sln.DotSettings +9 -0
  132. data/ext/libsass/win/libsass.targets +3 -0
  133. data/ext/libsass/win/libsass.vcxproj.filters +9 -0
  134. data/lib/sassc/version.rb +1 -1
  135. data/sassc.gemspec +1 -1
  136. data/test/native_test.rb +1 -1
  137. metadata +11 -4
@@ -7,8 +7,13 @@ environment:
7
7
  matrix:
8
8
  - Compiler: msvc
9
9
  Config: Release
10
+ Platform: Win32
10
11
  - Compiler: msvc
11
12
  Config: Debug
13
+ Platform: Win32
14
+ - Compiler: msvc
15
+ Config: Release
16
+ Platform: Win64
12
17
  - Compiler: mingw
13
18
  Build: static
14
19
  - Compiler: mingw
@@ -38,7 +43,7 @@ build_script:
38
43
  if ($env:Compiler -eq "mingw") {
39
44
  mingw32-make -j4 sassc
40
45
  } else {
41
- msbuild /m:4 /p:Configuration=$env:Config sassc\win\sassc.sln
46
+ msbuild /m:4 /p:"Configuration=$env:Config;Platform=$env:Platform" sassc\win\sassc.sln
42
47
  }
43
48
 
44
49
  # print the branding art
@@ -65,7 +70,7 @@ test_script:
65
70
  }
66
71
  $env:TargetPath = Join-Path $pwd.Path $env:TargetPath
67
72
  If (Test-Path "$env:TargetPath") {
68
- ruby sass-spec/sass-spec.rb -V 3.4 --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
73
+ ruby sass-spec/sass-spec.rb -V 3.5 --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
69
74
  if(-not($?)) {
70
75
  echo "sass-spec tests failed"
71
76
  exit 1
@@ -84,4 +89,3 @@ test_script:
84
89
  } else {
85
90
  echo "Success!"
86
91
  }
87
-
@@ -9,6 +9,7 @@ AC_CONFIG_MACRO_DIR([m4])
9
9
  AC_CONFIG_HEADERS([src/config.h])
10
10
  AC_CONFIG_FILES([include/sass/version.h])
11
11
  AC_CONFIG_AUX_DIR([script])
12
+
12
13
  # These are flags passed to automake
13
14
  # Though they look like gcc flags!
14
15
  AM_INIT_AUTOMAKE([foreign parallel-tests -Wall])
@@ -93,21 +94,16 @@ the --with-sass-spec-dir=<dir> argument.
93
94
  ;;
94
95
  esac
95
96
  AC_SUBST(SASS_SPEC_PATH)
96
-
97
- # TODO: Remove this when automake requirements are 1.12+
98
- AC_MSG_CHECKING([whether we can use TAP mode])
99
- tmp=`$AWK '/TEST_LOG_DRIVER/' $srcdir/GNUmakefile.in`
100
- if test "x$tmp" != "x"; then
101
- use_tap=yes
102
- else
103
- use_tap=no
104
- fi
105
- AC_MSG_RESULT([$use_tap])
106
-
97
+ else
98
+ # we do not really need these paths for non test build
99
+ # but automake may error if we do not define them here
100
+ SASS_SPEC_PATH=sass-spec
101
+ SASS_SASSC_PATH=sassc
102
+ AC_SUBST(SASS_SPEC_PATH)
103
+ AC_SUBST(SASS_SASSC_PATH)
107
104
  fi
108
105
 
109
106
  AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = "xyes")
110
- AM_CONDITIONAL(USE_TAP, test "x$use_tap" = "xyes")
111
107
 
112
108
  AC_ARG_ENABLE([coverage],
113
109
  [AS_HELP_STRING([--enable-coverage],
@@ -121,8 +117,8 @@ if test "x$enable_cov" = "xyes"; then
121
117
 
122
118
  # Remove all optimization flags from C[XX]FLAGS
123
119
  changequote({,})
124
- CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
125
- CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
120
+ CFLAGS=`echo "$CFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
121
+ CXXFLAGS=`echo "$CXXFLAGS -O1 -fno-omit-frame-pointer" | $SED -e 's/-O[0-9]*//g'`
126
122
  changequote([,])
127
123
 
128
124
  AC_SUBST(GCOV)
@@ -7,26 +7,35 @@ enum Sass_Input_Style {
7
7
  SASS_CONTEXT_FOLDER
8
8
  };
9
9
 
10
- // simple linked list
11
- struct string_list {
12
- string_list* next;
13
- char* string;
14
- };
15
-
16
10
  // sass config options structure
17
- struct Sass_Options {
18
-
19
- // Precision for fractional numbers
20
- int precision;
11
+ struct Sass_Inspect_Options {
21
12
 
22
13
  // Output style for the generated css code
23
14
  // A value from above SASS_STYLE_* constants
24
15
  enum Sass_Output_Style output_style;
25
16
 
17
+ // Precision for fractional numbers
18
+ int precision;
19
+
20
+ };
21
+
22
+ // sass config options structure
23
+ struct Sass_Output_Options : Sass_Inspect_Options {
24
+
25
+ // String to be used for indentation
26
+ const char* indent;
27
+ // String to be used to for line feeds
28
+ const char* linefeed;
29
+
26
30
  // Emit comments in the generated CSS indicating
27
31
  // the corresponding source line.
28
32
  bool source_comments;
29
33
 
34
+ };
35
+
36
+ // sass config options structure
37
+ struct Sass_Options : Sass_Output_Options {
38
+
30
39
  // embed sourceMappingUrl as data uri
31
40
  bool source_map_embed;
32
41
 
@@ -56,15 +65,9 @@ struct Sass_Options {
56
65
  // information in source-maps etc.
57
66
  char* output_path;
58
67
 
59
- // String to be used for indentation
60
- const char* indent;
61
- // String to be used to for line feeds
62
- const char* linefeed;
63
-
64
68
  // Colon-separated list of paths
65
69
  // Semicolon-separated on Windows
66
- // Note: It may be better to use
67
- // array interface instead
70
+ // Maybe use array interface instead?
68
71
  char* include_path;
69
72
  char* plugin_path;
70
73
 
@@ -82,10 +85,13 @@ struct Sass_Options {
82
85
  char* source_map_root;
83
86
 
84
87
  // Custom functions that can be called from sccs code
85
- Sass_C_Function_List c_functions;
88
+ Sass_Function_List c_functions;
86
89
 
87
90
  // Callback to overload imports
88
- Sass_C_Import_Callback importer;
91
+ Sass_Importer_List c_importers;
92
+
93
+ // List of custom headers
94
+ Sass_Importer_List c_headers;
89
95
 
90
96
  };
91
97
 
@@ -111,6 +117,7 @@ struct Sass_Context : Sass_Options
111
117
  char* error_file;
112
118
  size_t error_line;
113
119
  size_t error_column;
120
+ const char* error_src;
114
121
 
115
122
  // report imported files
116
123
  char** included_files;
@@ -130,6 +137,7 @@ struct Sass_Data_Context : Sass_Context {
130
137
 
131
138
  // provided source string
132
139
  char* source_string;
140
+ char* srcmap_string;
133
141
 
134
142
  };
135
143
 
@@ -147,9 +155,9 @@ struct Sass_Compiler {
147
155
  // original c context
148
156
  Sass_Context* c_ctx;
149
157
  // Sass::Context
150
- void* cpp_ctx;
158
+ Sass::Context* cpp_ctx;
151
159
  // Sass::Block
152
- void* root;
160
+ Sass::Block_Obj root;
153
161
  };
154
162
  ```
155
163
 
@@ -207,6 +207,15 @@ size_t sass_context_get_error_column (struct Sass_Context* ctx);
207
207
  const char* sass_context_get_source_map_string (struct Sass_Context* ctx);
208
208
  char** sass_context_get_included_files (struct Sass_Context* ctx);
209
209
 
210
+ // Getters for Sass_Compiler options (query import stack)
211
+ size_t sass_compiler_get_import_stack_size(struct Sass_Compiler* compiler);
212
+ Sass_Import_Entry sass_compiler_get_last_import(struct Sass_Compiler* compiler);
213
+ Sass_Import_Entry sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx);
214
+ // Getters for Sass_Compiler options (query function stack)
215
+ size_t sass_compiler_get_callee_stack_size(struct Sass_Compiler* compiler);
216
+ Sass_Callee_Entry sass_compiler_get_last_callee(struct Sass_Compiler* compiler);
217
+ Sass_Callee_Entry sass_compiler_get_callee_entry(struct Sass_Compiler* compiler, size_t idx);
218
+
210
219
  // Take ownership of memory (value on context is set to 0)
211
220
  char* sass_context_take_error_json (struct Sass_Context* ctx);
212
221
  char* sass_context_take_error_text (struct Sass_Context* ctx);
@@ -214,10 +223,6 @@ char* sass_context_take_error_message (struct Sass_Context* ctx);
214
223
  char* sass_context_take_error_file (struct Sass_Context* ctx);
215
224
  char* sass_context_take_output_string (struct Sass_Context* ctx);
216
225
  char* sass_context_take_source_map_string (struct Sass_Context* ctx);
217
-
218
- // Push function for plugin/include paths (no manipulation support for now)
219
- void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
220
- void sass_option_push_include_path (struct Sass_Options* options, const char* path);
221
226
  ```
222
227
 
223
228
  ### Sass Options API
@@ -236,13 +241,18 @@ const char* sass_option_get_indent (struct Sass_Options* options);
236
241
  const char* sass_option_get_linefeed (struct Sass_Options* options);
237
242
  const char* sass_option_get_input_path (struct Sass_Options* options);
238
243
  const char* sass_option_get_output_path (struct Sass_Options* options);
239
- const char* sass_option_get_plugin_path (struct Sass_Options* options);
240
- const char* sass_option_get_include_path (struct Sass_Options* options);
241
244
  const char* sass_option_get_source_map_file (struct Sass_Options* options);
242
245
  const char* sass_option_get_source_map_root (struct Sass_Options* options);
243
246
  Sass_C_Function_List sass_option_get_c_functions (struct Sass_Options* options);
244
247
  Sass_C_Import_Callback sass_option_get_importer (struct Sass_Options* options);
245
248
 
249
+ // Getters for Context_Option include path array
250
+ size_t sass_option_get_include_path_size(struct Sass_Options* options);
251
+ const char* sass_option_get_include_path(struct Sass_Options* options, size_t i);
252
+ // Plugin paths to load dynamic libraries work the same
253
+ size_t sass_option_get_plugin_path_size(struct Sass_Options* options);
254
+ const char* sass_option_get_plugin_path(struct Sass_Options* options, size_t i);
255
+
246
256
  // Setters for Context_Option values
247
257
  void sass_option_set_precision (struct Sass_Options* options, int precision);
248
258
  void sass_option_set_output_style (struct Sass_Options* options, enum Sass_Output_Style output_style);
@@ -266,6 +276,16 @@ void sass_option_set_importer (struct Sass_Options* options, Sass_C_Import_Callb
266
276
  // Push function for paths (no manipulation support for now)
267
277
  void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
268
278
  void sass_option_push_include_path (struct Sass_Options* options, const char* path);
279
+
280
+ // Resolve a file via the given include paths in the sass option struct
281
+ // find_file looks for the exact file name while find_include does a regular sass include
282
+ char* sass_find_file (const char* path, struct Sass_Options* opt);
283
+ char* sass_find_include (const char* path, struct Sass_Options* opt);
284
+
285
+ // Resolve a file relative to last import or include paths in the sass option struct
286
+ // find_file looks for the exact file name while find_include does a regular sass include
287
+ char* sass_compiler_find_file (const char* path, struct Sass_Compiler* compiler);
288
+ char* sass_compiler_find_include (const char* path, struct Sass_Compiler* compiler);
269
289
  ```
270
290
 
271
291
  ### More links
@@ -1,6 +1,9 @@
1
1
  ## Introduction
2
2
 
3
- LibSass wouldn't be much good without a way to interface with it. These interface documentations describe the various functions and data structures available to implementers. They are split up over three major components, which have all their own source files (plus some common functionality).
3
+ LibSass wouldn't be much good without a way to interface with it. These
4
+ interface documentations describe the various functions and data structures
5
+ available to implementers. They are split up over three major components, which
6
+ have all their own source files (plus some common functionality).
4
7
 
5
8
  - [Sass Context](api-context.md) - Trigger and handle the main Sass compilation
6
9
  - [Sass Value](api-value.md) - Exchange values and its format with LibSass
@@ -41,7 +44,12 @@ gcc -Wall version.c -lsass -o version && ./version
41
44
 
42
45
  ## Compiling your code
43
46
 
44
- The most important is your sass file (or string of sass code). With this, you will want to start a LibSass compiler. Here is some pseudocode describing the process. The compiler has two different modes: direct input as a string with `Sass_Data_Context` or LibSass will do file reading for you by using `Sass_File_Context`. See the code for a list of options available [Sass_Options](https://github.com/sass/libsass/blob/36feef0/include/sass/interface.h#L18)
47
+ The most important is your sass file (or string of sass code). With this, you
48
+ will want to start a LibSass compiler. Here is some pseudocode describing the
49
+ process. The compiler has two different modes: direct input as a string with
50
+ `Sass_Data_Context` or LibSass will do file reading for you by using
51
+ `Sass_File_Context`. See the code for a list of options available
52
+ [Sass_Options](https://github.com/sass/libsass/blob/36feef0/include/sass/interface.h#L18)
45
53
 
46
54
  **Building a file compiler**
47
55
 
@@ -97,7 +105,9 @@ struct Sass_Data_context : Sass_Context;
97
105
 
98
106
  This mirrors very well how `libsass` uses these structures.
99
107
 
100
- - `Sass_Options` holds everything you feed in before the compilation. It also hosts `input_path` and `output_path` options, because they are used to generate/calculate relative links in source-maps. The `input_path` is shared with `Sass_File_Context`.
108
+ - `Sass_Options` holds everything you feed in before the compilation. It also hosts
109
+ `input_path` and `output_path` options, because they are used to generate/calculate
110
+ relative links in source-maps. The `input_path` is shared with `Sass_File_Context`.
101
111
  - `Sass_Context` holds all the data returned by the compilation step.
102
112
  - `Sass_File_Context` is a specific implementation that requires no additional fields
103
113
  - `Sass_Data_Context` is a specific implementation that adds the `input_source` field
@@ -106,8 +116,11 @@ Structs can be down-casted to access `context` or `options`!
106
116
 
107
117
  ## Memory handling and life-cycles
108
118
 
109
- We keep memory around for as long as the main [context](api-context.md) object is not destroyed (`sass_delete_context`). LibSass will create copies of most inputs/options beside the main sass code.
110
- You need to allocate and fill that buffer before passing it to LibSass. You may also overtake memory management from libsass for certain return values (i.e. `sass_context_take_output_string`).
119
+ We keep memory around for as long as the main [context](api-context.md) object
120
+ is not destroyed (`sass_delete_context`). LibSass will create copies of most
121
+ inputs/options beside the main sass code. You need to allocate and fill that
122
+ buffer before passing it to LibSass. You may also overtake memory management
123
+ from libsass for certain return values (i.e. `sass_context_take_output_string`).
111
124
 
112
125
  ```C
113
126
  // to allocate buffer to be filled
@@ -125,9 +138,6 @@ void sass_free_memory(void* ptr);
125
138
  char* sass_string_unquote (const char* str);
126
139
  char* sass_string_quote (const char* str, const char quote_mark);
127
140
 
128
- // Resolve a file via the given include paths in the include char* array
129
- char* sass_resolve_file (const char* path, const char* incs[]);
130
-
131
141
  // Get compiled libsass version
132
142
  const char* libsass_version(void);
133
143
 
@@ -140,15 +150,25 @@ const char* libsass_language_version(void);
140
150
 
141
151
  **input_path**
142
152
 
143
- The `input_path` is part of `Sass_Options`, but it also is the main option for `Sass_File_Context`. It is also used to generate relative file links in source-maps. Therefore it is pretty usefull to pass this information if you have a `Sass_Data_Context` and know the original path.
153
+ The `input_path` is part of `Sass_Options`, but it also is the main option for
154
+ `Sass_File_Context`. It is also used to generate relative file links in source-
155
+ maps. Therefore it is pretty usefull to pass this information if you have a
156
+ `Sass_Data_Context` and know the original path.
144
157
 
145
158
  **output_path**
146
159
 
147
- Be aware that `libsass` does not write the output file itself. This option merely exists to give `libsass` the proper information to generate links in source-maps. The file has to be written to the disk by the binding/implementation. If the `output_path` is omitted, `libsass` tries to extrapolate one from the `input_path` by replacing (or adding) the file ending with `.css`.
160
+ Be aware that `libsass` does not write the output file itself. This option
161
+ merely exists to give `libsass` the proper information to generate links in
162
+ source-maps. The file has to be written to the disk by the
163
+ binding/implementation. If the `output_path` is omitted, `libsass` tries to
164
+ extrapolate one from the `input_path` by replacing (or adding) the file ending
165
+ with `.css`.
148
166
 
149
167
  ## Error Codes
150
168
 
151
- The `error_code` is integer value which indicates the type of error that occurred inside the LibSass process. Following is the list of error codes along with the short description:
169
+ The `error_code` is integer value which indicates the type of error that
170
+ occurred inside the LibSass process. Following is the list of error codes along
171
+ with the short description:
152
172
 
153
173
  * 1: normal errors like parsing or `eval` errors
154
174
  * 2: bad allocation error (memory error)
@@ -156,23 +176,36 @@ The `error_code` is integer value which indicates the type of error that occurre
156
176
  * 4: legacy string exceptions ( `throw const char*` or `std::string` )
157
177
  * 5: Some other unknown exception
158
178
 
159
- Although for the API consumer, error codes do not offer much value except indicating whether *any* error occurred during the compilation, it helps debugging the LibSass internal code paths.
179
+ Although for the API consumer, error codes do not offer much value except
180
+ indicating whether *any* error occurred during the compilation, it helps
181
+ debugging the LibSass internal code paths.
160
182
 
161
183
  ## Real-World Implementations
162
184
 
163
- The proof is in the pudding, so we have highlighted a few implementations that should be on par with the latest LibSass interface version. Some of them may not have all features implemented!
185
+ The proof is in the pudding, so we have highlighted a few implementations that
186
+ should be on par with the latest LibSass interface version. Some of them may not
187
+ have all features implemented!
164
188
 
165
189
  1. [Perl Example](https://github.com/sass/perl-libsass/blob/master/lib/CSS/Sass.xs)
166
- 2. [Go Example](http://godoc.org/github.com/wellington/go-libsass#example-Context-Compile)
190
+ 2. [Go Example](https://godoc.org/github.com/wellington/go-libsass#example-Compiler--Stdin)
167
191
  3. [Node Example](https://github.com/sass/node-sass/blob/master/src/binding.cpp)
168
192
 
169
193
  ## ABI forward compatibility
170
194
 
171
- We use a functional API to make dynamic linking more robust and future compatible. The API is not yet 100% stable, so we do not yet guarantee [ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) forward compatibility. We will do so, once we increase the shared library version above 1.0.
195
+ We use a functional API to make dynamic linking more robust and future
196
+ compatible. The API is not yet 100% stable, so we do not yet guarantee
197
+ [ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) forward
198
+ compatibility.
172
199
 
173
200
  ## Plugins (experimental)
174
201
 
175
- LibSass can load plugins from directories. Just define `plugin_path` on context options to load all plugins from the given directories. To implement plugins, please consult the [[Wiki-Page for plugins|API-Plugins]].
202
+ LibSass can load plugins from directories. Just define `plugin_path` on context
203
+ options to load all plugins from the directories. To implement plugins, please
204
+ consult the following example implementations.
205
+
206
+ - https://github.com/mgreter/libsass-glob
207
+ - https://github.com/mgreter/libsass-math
208
+ - https://github.com/mgreter/libsass-digest
176
209
 
177
210
  ## Internal Structs
178
211
 
@@ -11,7 +11,7 @@ union Sass_Value* call_fn_foo(const union Sass_Value* s_args, Sass_Function_Entr
11
11
  struct Sass_Context* ctx = sass_compiler_get_context(comp);
12
12
  struct Sass_Options* opts = sass_compiler_get_options(comp);
13
13
  // get information about previous importer entry from the stack
14
- struct Sass_Import* import = sass_compiler_get_last_import(comp);
14
+ Sass_Import_Entry import = sass_compiler_get_last_import(comp);
15
15
  const char* prev_abs_path = sass_import_get_abs_path(import);
16
16
  const char* prev_imp_path = sass_import_get_imp_path(import);
17
17
  // get the cookie from function descriptor
@@ -30,17 +30,41 @@ typedef union Sass_Value* (*Sass_Function_Fn)
30
30
  (const union Sass_Value*, Sass_Function_Entry cb, struct Sass_Compiler* compiler);
31
31
 
32
32
  // Creators for sass function list and function descriptors
33
- ADDAPI Sass_Function_List ADDCALL sass_make_function_list (size_t length);
34
- ADDAPI Sass_Function_Entry ADDCALL sass_make_function (const char* signature, Sass_Function_Fn cb, void* cookie);
33
+ Sass_Function_List sass_make_function_list (size_t length);
34
+ Sass_Function_Entry sass_make_function (const char* signature, Sass_Function_Fn cb, void* cookie);
35
+ // In case you need to free them yourself
36
+ void sass_delete_function (Sass_Function_Entry entry);
37
+ void sass_delete_function_list (Sass_Function_List list);
35
38
 
36
39
  // Setters and getters for callbacks on function lists
37
- ADDAPI Sass_Function_Entry ADDCALL sass_function_get_list_entry(Sass_Function_List list, size_t pos);
38
- ADDAPI void ADDCALL sass_function_set_list_entry(Sass_Function_List list, size_t pos, Sass_Function_Entry cb);
40
+ Sass_Function_Entry sass_function_get_list_entry(Sass_Function_List list, size_t pos);
41
+ void sass_function_set_list_entry(Sass_Function_List list, size_t pos, Sass_Function_Entry cb);
42
+
43
+ // Setters to insert an entry into the import list (you may also use [] access directly)
44
+ // Since we are dealing with pointers they should have a guaranteed and fixed size
45
+ void sass_import_set_list_entry (Sass_Import_List list, size_t idx, Sass_Import_Entry entry);
46
+ Sass_Import_Entry sass_import_get_list_entry (Sass_Import_List list, size_t idx);
39
47
 
40
48
  // Getters for custom function descriptors
41
- ADDAPI const char* ADDCALL sass_function_get_signature (Sass_Function_Entry cb);
42
- ADDAPI Sass_Function_Fn ADDCALL sass_function_get_function (Sass_Function_Entry cb);
43
- ADDAPI void* ADDCALL sass_function_get_cookie (Sass_Function_Entry cb);
49
+ const char* sass_function_get_signature (Sass_Function_Entry cb);
50
+ Sass_Function_Fn sass_function_get_function (Sass_Function_Entry cb);
51
+ void* sass_function_get_cookie (Sass_Function_Entry cb);
52
+
53
+ // Getters for callee entry
54
+ const char* sass_callee_get_name (Sass_Callee_Entry);
55
+ const char* sass_callee_get_path (Sass_Callee_Entry);
56
+ size_t sass_callee_get_line (Sass_Callee_Entry);
57
+ size_t sass_callee_get_column (Sass_Callee_Entry);
58
+ enum Sass_Callee_Type sass_callee_get_type (Sass_Callee_Entry);
59
+ Sass_Env_Frame sass_callee_get_env (Sass_Callee_Entry);
60
+
61
+ // Getters and Setters for environments (lexical, local and global)
62
+ union Sass_Value* sass_env_get_lexical (Sass_Env_Frame, const char*);
63
+ void sass_env_set_lexical (Sass_Env_Frame, const char*, union Sass_Value*);
64
+ union Sass_Value* sass_env_get_local (Sass_Env_Frame, const char*);
65
+ void sass_env_set_local (Sass_Env_Frame, const char*, union Sass_Value*);
66
+ union Sass_Value* sass_env_get_global (Sass_Env_Frame, const char*);
67
+ void sass_env_set_global (Sass_Env_Frame, const char*, union Sass_Value*);
44
68
  ```
45
69
 
46
70
  ### More links
@@ -5,7 +5,7 @@ By using custom importers, Sass stylesheets can be implemented in any possible w
5
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
6
 
7
7
  ```C
8
- struct Sass_Import** rv = sass_make_import_list(1);
8
+ Sass_Import_Entry* rv = sass_make_import_list(1);
9
9
  rv[0] = sass_make_import(rel, abs, source, srcmap);
10
10
  ```
11
11
 
@@ -31,7 +31,7 @@ struct Sass_C_Import_Descriptor;
31
31
  // Typedef defining the custom importer callback
32
32
  typedef struct Sass_C_Import_Descriptor (*Sass_C_Import_Callback);
33
33
  // Typedef defining the importer c function prototype
34
- typedef struct Sass_Import** (*Sass_C_Import_Fn) (const char* url, const char* prev, void* cookie);
34
+ typedef Sass_Import_Entry* (*Sass_C_Import_Fn) (const char* url, const char* prev, void* cookie);
35
35
 
36
36
  // Creators for custom importer callback (with some additional pointer)
37
37
  // The pointer is mostly used to store the callback into the actual function
@@ -45,38 +45,38 @@ void* sass_import_get_cookie (Sass_C_Import_Callback fn);
45
45
  void sass_delete_importer (Sass_C_Import_Callback fn);
46
46
 
47
47
  // Creator for sass custom importer return argument list
48
- struct Sass_Import** sass_make_import_list (size_t length);
48
+ Sass_Import_Entry* sass_make_import_list (size_t length);
49
49
  // Creator for a single import entry returned by the custom importer inside the list
50
- struct Sass_Import* sass_make_import_entry (const char* path, char* source, char* srcmap);
51
- struct Sass_Import* sass_make_import (const char* rel, const char* abs, char* source, char* srcmap);
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
52
 
53
53
  // set error message to abort import and to print out a message (path from existing object is used in output)
54
- struct Sass_Import* sass_import_set_error(struct Sass_Import* import, const char* message, size_t line, size_t col);
54
+ Sass_Import_Entry sass_import_set_error(Sass_Import_Entry import, const char* message, size_t line, size_t col);
55
55
 
56
56
  // Setters to insert an entry into the import list (you may also use [] access directly)
57
57
  // Since we are dealing with pointers they should have a guaranteed and fixed size
58
- void sass_import_set_list_entry (struct Sass_Import** list, size_t idx, struct Sass_Import* entry);
59
- struct Sass_Import* sass_import_get_list_entry (struct Sass_Import** list, size_t idx);
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
60
 
61
61
  // Getters for import entry
62
- const char* sass_import_get_rel_path (struct Sass_Import*);
63
- const char* sass_import_get_abs_path (struct Sass_Import*);
64
- const char* sass_import_get_source (struct Sass_Import*);
65
- const char* sass_import_get_srcmap (struct Sass_Import*);
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
66
  // Explicit functions to take ownership of these items
67
67
  // The property on our struct will be reset to NULL
68
- char* sass_import_take_source (struct Sass_Import*);
69
- char* sass_import_take_srcmap (struct Sass_Import*);
68
+ char* sass_import_take_source (Sass_Import_Entry);
69
+ char* sass_import_take_srcmap (Sass_Import_Entry);
70
70
 
71
71
  // Getters for import error entries
72
- size_t sass_import_get_error_line (struct Sass_Import*);
73
- size_t sass_import_get_error_column (struct Sass_Import*);
74
- const char* sass_import_get_error_message (struct Sass_Import*);
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
75
 
76
76
  // Deallocator for associated memory (incl. entries)
77
- void sass_delete_import_list (struct Sass_Import**);
77
+ void sass_delete_import_list (Sass_Import_Entry*);
78
78
  // Just in case we have some stray import structs
79
- void sass_delete_import (struct Sass_Import*);
79
+ void sass_delete_import (Sass_Import_Entry);
80
80
  ```
81
81
 
82
82
  ### More links