| 1 |
|
| // Copyright (c) 2013-2014 David Caldwell.
|
| 2 |
|
| // Copyright (c) 2014-2017 Marcel Greter.
|
| 3 |
|
| //
|
| 4 |
|
| // Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 5 |
|
| // of this software and associated documentation files (the "Software"), to deal
|
| 6 |
|
| // in the Software without restriction, including without limitation the rights
|
| 7 |
|
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 8 |
|
| // copies of the Software, and to permit persons to whom the Software is
|
| 9 |
|
| // furnished to do so, subject to the following conditions:
|
| 10 |
|
| //
|
| 11 |
|
| // The above copyright notice and this permission notice shall be included in
|
| 12 |
|
| // all copies or substantial portions of the Software.
|
| 13 |
|
| //
|
| 14 |
|
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 15 |
|
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 16 |
|
| // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 17 |
|
| // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 18 |
|
| // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 19 |
|
| // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 20 |
|
| // THE SOFTWARE.
|
| 21 |
|
|
|
| 22 |
|
| // dont hook libc calls
|
| 23 |
|
| #define NO_XSLOCKS
|
| 24 |
|
|
|
| 25 |
|
| #ifdef __cplusplus
|
| 26 |
|
| extern "C" {
|
| 27 |
|
| #endif
|
| 28 |
|
|
|
| 29 |
|
| #include "EXTERN.h"
|
| 30 |
|
| #undef my_setlocale
|
| 31 |
|
| #include "perl.h"
|
| 32 |
|
| #include "XSUB.h"
|
| 33 |
|
| #include "ppport.h"
|
| 34 |
|
|
|
| 35 |
|
| #ifdef __cplusplus
|
| 36 |
|
| }
|
| 37 |
|
| #endif
|
| 38 |
|
|
|
| 39 |
|
| #include <stdbool.h>
|
| 40 |
|
| #include <stdarg.h>
|
| 41 |
|
| #include <stdio.h>
|
| 42 |
|
| #include <sass.h>
|
| 43 |
|
|
|
| 44 |
|
| #define isSafeSv(sv) sv && SvOK(*sv)
|
| 45 |
|
| #define Constant(c) newCONSTSUB(stash, #c, newSViv(c))
|
| 46 |
|
|
|
| 47 |
|
| #undef free
|
| 48 |
|
|
|
| 49 |
|
| // implement this logic here for now
|
| 50 |
|
| // libsass has no auto quoting concept
|
| 51 |
0 |
| bool sass_string_need_quotes(char* str)
|
| 52 |
|
| {
|
| 53 |
0 |
| char* it = str;
|
| 54 |
0 |
▶ | if (*it == 0) return false;
|
Branch: 1 branch
| Branch | True | False | Total |
| if (*it == 0) return false;
|
0 |
0 |
0 |
|
| 55 |
0 |
| if (!(
|
| 56 |
0 |
▶ | (*it >= 'a' && *it <= 'z') ||
|
Branch: 2 branches
| Branch | True | False | Total |
| (*it >= 'a' && *it <= 'z') ||
|
0 |
0 |
0 |
| (*it >= 'a' && *it <= 'z') ||
|
0 |
0 |
0 |
|
| 57 |
0 |
▶ | (*it >= 'A' && *it <= 'Z')
|
Branch: 2 branches
| Branch | True | False | Total |
| (*it >= 'A' && *it <= 'Z')
|
0 |
0 |
0 |
| (*it >= 'A' && *it <= 'Z')
|
0 |
0 |
0 |
|
| 58 |
0 |
| )) return true;
|
| 59 |
0 |
| ++it;
|
| 60 |
0 |
▶ | while (*it) {
|
Branch: 1 branch
| Branch | True | False | Total |
| while (*it) {
|
0 |
0 |
0 |
|
| 61 |
0 |
| if (!(
|
| 62 |
0 |
▶ | (*it >= 127) ||
|
Branch: 1 branch
| Branch | True | False | Total |
| (*it >= 127) ||
|
0 |
0 |
0 |
|
| 63 |
0 |
▶ | (*it >= '0' && *it <= '9') ||
|
Branch: 2 branches
| Branch | True | False | Total |
| (*it >= '0' && *it <= '9') ||
|
0 |
0 |
0 |
| (*it >= '0' && *it <= '9') ||
|
0 |
0 |
0 |
|
| 64 |
0 |
▶ | (*it >= 'a' && *it <= 'z') ||
|
Branch: 2 branches
| Branch | True | False | Total |
| (*it >= 'a' && *it <= 'z') ||
|
0 |
0 |
0 |
| (*it >= 'a' && *it <= 'z') ||
|
0 |
0 |
0 |
|
| 65 |
0 |
▶ | (*it >= 'A' && *it <= 'Z') ||
|
Branch: 2 branches
| Branch | True | False | Total |
| (*it >= 'A' && *it <= 'Z') ||
|
0 |
0 |
0 |
| (*it >= 'A' && *it <= 'Z') ||
|
0 |
0 |
0 |
|
| 66 |
0 |
▶ | (*it == '\\' && *(it+1) != 0)
|
Branch: 2 branches
| Branch | True | False | Total |
| (*it == '\\' && *(it+1) != 0)
|
0 |
0 |
0 |
| (*it == '\\' && *(it+1) != 0)
|
0 |
0 |
0 |
|
| 67 |
0 |
| )) return true;
|
| 68 |
0 |
| ++it;
|
| 69 |
|
| }
|
| 70 |
0 |
| return false;
|
| 71 |
|
| }
|
| 72 |
|
|
|
| 73 |
0 |
| char* safe_svpv(SV* sv, char* _default)
|
| 74 |
|
| {
|
| 75 |
|
|
|
| 76 |
|
| size_t length;
|
| 77 |
0 |
| char* str = SvPV(sv, length);
|
| 78 |
|
| // NULL Terminated "array"
|
| 79 |
0 |
▶ | if (memchr(str, 0, length + 1))
|
Branch: 1 branch
| Branch | True | False | Total |
| if (memchr(str, 0, length + 1))
|
0 |
0 |
0 |
|
| 80 |
0 |
| return str;
|
| 81 |
0 |
| return _default;
|
| 82 |
|
| }
|
| 83 |
|
|
|
| 84 |
0 |
| union Sass_Value* sass_make_error_f(char* format,...)
|
| 85 |
|
| {
|
| 86 |
|
| va_list ap;
|
| 87 |
0 |
| va_start(ap, format);
|
| 88 |
0 |
| SV* res = vnewSVpvf(format, &ap);
|
| 89 |
0 |
| va_end(ap);
|
| 90 |
0 |
| return sass_make_error(SvPV_nolen(res));
|
| 91 |
|
| }
|
| 92 |
|
|
|
| 93 |
|
| // convert from perl to libsass
|
| 94 |
0 |
| union Sass_Value* sv_to_sass_value(SV* sv)
|
| 95 |
|
| {
|
| 96 |
|
|
|
| 97 |
|
| // remember me
|
| 98 |
0 |
| SV* org = sv;
|
| 99 |
|
|
|
| 100 |
|
| // dereference if possible
|
| 101 |
0 |
▶ | if (SvROK(sv)) sv = SvRV(sv);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(sv)) sv = SvRV(sv);
|
0 |
0 |
0 |
|
| 102 |
|
|
|
| 103 |
|
| // have a scalar value
|
| 104 |
0 |
▶ | if (SvTYPE(sv) < SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(sv) < SVt_PVAV) {
|
0 |
0 |
0 |
|
| 105 |
|
|
|
| 106 |
|
| // if scalar is undef we return a null type
|
| 107 |
0 |
▶ | if (!SvOK(sv)) return sass_make_null();
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK(sv)) return sass_make_null();
|
0 |
0 |
0 |
|
| 108 |
|
|
|
| 109 |
|
| // perl double
|
| 110 |
0 |
▶ | else if (SvNOK(sv)) { // i.e. 4.2
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvNOK(sv)) { // i.e. 4.2
|
0 |
0 |
0 |
|
| 111 |
|
| // perl doesn't know numbers with units
|
| 112 |
0 |
| return sass_make_number(SvNV(sv), "");
|
| 113 |
|
| }
|
| 114 |
|
| // perl integer
|
| 115 |
0 |
▶ | else if (SvIOK(sv)) { // i.e. 42
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvIOK(sv)) { // i.e. 42
|
0 |
0 |
0 |
|
| 116 |
|
| // perl doesn't know numbers with units
|
| 117 |
0 |
| return sass_make_number(SvIV(sv), "");
|
| 118 |
|
| }
|
| 119 |
|
| // perl string
|
| 120 |
0 |
▶ | else if (SvPOK(sv)) { // i.e. "foobar"
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvPOK(sv)) { // i.e. "foobar"
|
0 |
0 |
0 |
|
| 121 |
0 |
| char* str = SvPV_nolen(sv);
|
| 122 |
|
| // coerce all other scalars into a string
|
| 123 |
|
| // IMO there should only be strings left!?
|
| 124 |
0 |
▶ | if (sv_derived_from(org, "CSS::Sass::Value::String::Quoted"))
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_derived_from(org, "CSS::Sass::Value::String::Quoted"))
|
0 |
0 |
0 |
|
| 125 |
0 |
| { return sass_make_qstring(str); }
|
| 126 |
0 |
▶ | else if (sv_derived_from(org, "CSS::Sass::Value::String::Constant"))
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (sv_derived_from(org, "CSS::Sass::Value::String::Constant"))
|
0 |
0 |
0 |
|
| 127 |
0 |
| { return sass_make_string(str); }
|
| 128 |
|
| // perl-libsass autoquote behavior
|
| 129 |
0 |
▶ | if (sass_string_need_quotes(str))
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sass_string_need_quotes(str))
|
0 |
0 |
0 |
|
| 130 |
0 |
| { return sass_make_qstring(str); }
|
| 131 |
0 |
| else { return sass_make_string(str); }
|
| 132 |
|
| }
|
| 133 |
|
|
|
| 134 |
|
| // perl reference
|
| 135 |
0 |
▶ | else if (SvROK(sv)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvROK(sv)) {
|
0 |
0 |
0 |
|
| 136 |
|
|
|
| 137 |
|
| // dereference
|
| 138 |
0 |
| sv = SvRV(sv);
|
| 139 |
|
|
|
| 140 |
|
| // check out scalar value
|
| 141 |
0 |
▶ | if (SvTYPE(sv) < SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(sv) < SVt_PVAV) {
|
0 |
0 |
0 |
|
| 142 |
|
| // if scalar is undef we return a null type
|
| 143 |
0 |
▶ | if (!SvOK(sv)) return sass_make_null();
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK(sv)) return sass_make_null();
|
0 |
0 |
0 |
|
| 144 |
|
| // perl reference
|
| 145 |
0 |
▶ | if (SvROK(sv)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(sv)) {
|
0 |
0 |
0 |
|
| 146 |
|
| // dereference
|
| 147 |
0 |
| sv = SvRV(sv);
|
| 148 |
|
| // check if it's an error struct
|
| 149 |
0 |
▶ | if (SvTYPE(sv) == SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(sv) == SVt_PVAV) {
|
0 |
0 |
0 |
|
| 150 |
0 |
| bool has_msg = false;
|
| 151 |
0 |
▶ | if (av_len((AV*)sv) >= 0) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (av_len((AV*)sv) >= 0) {
|
0 |
0 |
0 |
|
| 152 |
0 |
| SV** value_svp = av_fetch((AV*)sv, 0, false);
|
| 153 |
0 |
▶ | has_msg = value_svp && *value_svp && SvOK(*value_svp);
|
Branch: 3 branches
| Branch | True | False | Total |
| has_msg = value_svp && *value_svp && SvOK(*value_svp);
|
0 |
0 |
0 |
| has_msg = value_svp && *value_svp && SvOK(*value_svp);
|
0 |
0 |
0 |
| has_msg = value_svp && *value_svp && SvOK(*value_svp);
|
0 |
0 |
0 |
|
| 154 |
0 |
▶ | return sass_make_error(has_msg ? SvPV_nolen(*value_svp) : "error");
|
Branch: 1 branch
| Branch | True | False | Total |
| return sass_make_error(has_msg ? SvPV_nolen(*value_svp) : "error");
|
0 |
0 |
0 |
|
| 155 |
|
| } else {
|
| 156 |
0 |
| return sass_make_error("error");
|
| 157 |
|
| }
|
| 158 |
|
| }
|
| 159 |
|
| // if we have a scalar
|
| 160 |
0 |
▶ | } else if (!SvROK(sv)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| } else if (!SvROK(sv)) {
|
0 |
0 |
0 |
|
| 161 |
|
| // then it is a boolean type
|
| 162 |
0 |
| return sass_make_boolean(SvTRUE(sv));
|
| 163 |
|
| }
|
| 164 |
|
| }
|
| 165 |
|
| // an array means we have a number
|
| 166 |
0 |
▶ | else if (SvTYPE(sv) == SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(sv) == SVt_PVAV) {
|
0 |
0 |
0 |
|
| 167 |
0 |
| AV* number = (AV*) sv;
|
| 168 |
0 |
| int len = av_len(number);
|
| 169 |
0 |
▶ | if (len >= 0) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (len >= 0) {
|
0 |
0 |
0 |
|
| 170 |
0 |
| SV* num = *av_fetch(number, 0, false);
|
| 171 |
0 |
▶ | if (SvIOK(num) || SvNOK(num)) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (SvIOK(num) || SvNOK(num)) {
|
0 |
0 |
0 |
| if (SvIOK(num) || SvNOK(num)) {
|
0 |
0 |
0 |
|
| 172 |
0 |
| double val = SvNV(num);
|
| 173 |
0 |
▶ | if (len > 0) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (len > 0) {
|
0 |
0 |
0 |
|
| 174 |
0 |
| SV** unit_svp = av_fetch(number, 1, false);
|
| 175 |
0 |
▶ | SV* unit_sv = unit_svp ? *unit_svp : newSVpv("", 0);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV* unit_sv = unit_svp ? *unit_svp : newSVpv("", 0);
|
0 |
0 |
0 |
|
| 176 |
0 |
| return sass_make_number(val, SvPV_nolen(unit_sv));
|
| 177 |
|
| }
|
| 178 |
0 |
| return sass_make_number(val, "");
|
| 179 |
|
| }
|
| 180 |
|
| }
|
| 181 |
|
| }
|
| 182 |
|
| // a hash means we have a color
|
| 183 |
0 |
▶ | else if (SvTYPE(sv) == SVt_PVHV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(sv) == SVt_PVHV) {
|
0 |
0 |
0 |
|
| 184 |
0 |
| HV* color = (HV*) sv;
|
| 185 |
0 |
| SV* sv_r = *hv_fetchs(color, "r", false);
|
| 186 |
0 |
| SV* sv_g = *hv_fetchs(color, "g", false);
|
| 187 |
0 |
| SV* sv_b = *hv_fetchs(color, "b", false);
|
| 188 |
0 |
| SV* sv_a = *hv_fetchs(color, "a", false);
|
| 189 |
0 |
| return sass_make_color(
|
| 190 |
0 |
▶ | SvOK(sv_r) ? SvNV(sv_r) : 0,
|
Branch: 1 branch
| Branch | True | False | Total |
| SvOK(sv_r) ? SvNV(sv_r) : 0,
|
0 |
0 |
0 |
|
| 191 |
0 |
▶ | SvOK(sv_g) ? SvNV(sv_g) : 0,
|
Branch: 1 branch
| Branch | True | False | Total |
| SvOK(sv_g) ? SvNV(sv_g) : 0,
|
0 |
0 |
0 |
|
| 192 |
0 |
▶ | SvOK(sv_b) ? SvNV(sv_b) : 0,
|
Branch: 1 branch
| Branch | True | False | Total |
| SvOK(sv_b) ? SvNV(sv_b) : 0,
|
0 |
0 |
0 |
|
| 193 |
0 |
▶ | SvOK(sv_a) ? SvNV(sv_a) : 0
|
Branch: 1 branch
| Branch | True | False | Total |
| SvOK(sv_a) ? SvNV(sv_a) : 0
|
0 |
0 |
0 |
|
| 194 |
|
| );
|
| 195 |
|
| }
|
| 196 |
|
|
|
| 197 |
|
| }
|
| 198 |
|
| // EO SvROK
|
| 199 |
|
|
|
| 200 |
|
| }
|
| 201 |
|
| // perl array reference
|
| 202 |
0 |
▶ | else if (SvTYPE(sv) == SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(sv) == SVt_PVAV) {
|
0 |
0 |
0 |
|
| 203 |
0 |
| AV* av = (AV*) sv;
|
| 204 |
0 |
| enum Sass_Separator sep = SASS_COMMA;
|
| 205 |
|
| // special check for space separated lists
|
| 206 |
0 |
▶ | if (sv_derived_from(org, "CSS::Sass::Value::List::Space")) sep = SASS_SPACE;
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_derived_from(org, "CSS::Sass::Value::List::Space")) sep = SASS_SPACE;
|
0 |
0 |
0 |
|
| 207 |
0 |
| union Sass_Value* list = sass_make_list(av_len(av) + 1, sep, false);
|
| 208 |
|
| size_t i;
|
| 209 |
0 |
▶ | for (i = 0; i < sass_list_get_length(list); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < sass_list_get_length(list); i++) {
|
0 |
0 |
0 |
|
| 210 |
0 |
| SV** value_svp = av_fetch(av, i, false);
|
| 211 |
0 |
▶ | SV* value_sv = value_svp ? *value_svp : &PL_sv_undef;
|
Branch: 1 branch
| Branch | True | False | Total |
| SV* value_sv = value_svp ? *value_svp : &PL_sv_undef;
|
0 |
0 |
0 |
|
| 212 |
0 |
| sass_list_set_value(list, i, sv_to_sass_value(value_sv));
|
| 213 |
|
| }
|
| 214 |
0 |
| return list;
|
| 215 |
|
| }
|
| 216 |
|
| // perl hash reference
|
| 217 |
0 |
▶ | else if (SvTYPE(sv) == SVt_PVHV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(sv) == SVt_PVHV) {
|
0 |
0 |
0 |
|
| 218 |
0 |
| HV* hv = (HV*) sv;
|
| 219 |
0 |
▶ | union Sass_Value* map = sass_make_map(HvUSEDKEYS(hv));
|
Branch: 1 branch
| Branch | True | False | Total |
| union Sass_Value* map = sass_make_map(HvUSEDKEYS(hv));
|
0 |
0 |
0 |
|
| 220 |
|
| HE* key;
|
| 221 |
0 |
| int i = 0;
|
| 222 |
0 |
| hv_iterinit(hv);
|
| 223 |
0 |
▶ | while (NULL != (key = hv_iternext(hv))) {
|
Branch: 1 branch
| Branch | True | False | Total |
| while (NULL != (key = hv_iternext(hv))) {
|
0 |
0 |
0 |
|
| 224 |
0 |
| void* key_ptr = HeKEY(key);
|
| 225 |
|
| // using the HePV makros gave me strange gcc warnings here:
|
| 226 |
|
| // dereferencing type-punned pointer will break strict-aliasing rules
|
| 227 |
0 |
| union Sass_Value* key_val = (HeKLEN(key) < 0)
|
| 228 |
0 |
| ? sv_to_sass_value((SV*) key_ptr)
|
| 229 |
0 |
▶ | : sass_make_string((char*) key_ptr);
|
Branch: 1 branch
| Branch | True | False | Total |
| : sass_make_string((char*) key_ptr);
|
0 |
0 |
0 |
|
| 230 |
0 |
| sass_map_set_key(map, i, key_val);
|
| 231 |
0 |
| sass_map_set_value(map, i, sv_to_sass_value(HeVAL(key)));
|
| 232 |
0 |
| i++;
|
| 233 |
|
| }
|
| 234 |
0 |
| return map;
|
| 235 |
|
| }
|
| 236 |
|
|
|
| 237 |
|
| // if scalar is undef we return a null type
|
| 238 |
0 |
▶ | if (!SvOK(sv)) return sass_make_null();
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK(sv)) return sass_make_null();
|
0 |
0 |
0 |
|
| 239 |
|
|
|
| 240 |
|
| // stringify anything else
|
| 241 |
|
| // can be usefull for soft-refs
|
| 242 |
0 |
| return sass_make_string(SvPV_nolen(sv));
|
| 243 |
|
|
|
| 244 |
|
| }
|
| 245 |
|
|
|
| 246 |
0 |
| SV* new_sv_sass_null () {
|
| 247 |
0 |
| SV* sv = newRV_noinc(newRV_noinc(newSV(0)));
|
| 248 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::Null", GV_ADD));
|
| 249 |
0 |
| return sv;
|
| 250 |
|
| }
|
| 251 |
|
|
|
| 252 |
0 |
| SV* new_sv_sass_string (SV* string, bool quoted) {
|
| 253 |
0 |
| SV* sv = newRV_noinc(string);
|
| 254 |
0 |
▶ | if (quoted) sv_bless(sv, gv_stashpv("CSS::Sass::Value::String::Quoted", GV_ADD));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (quoted) sv_bless(sv, gv_stashpv("CSS::Sass::Value::String::Quoted", GV_ADD));
|
0 |
0 |
0 |
|
| 255 |
0 |
| else { sv_bless(sv, gv_stashpv("CSS::Sass::Value::String::Constant", GV_ADD)); }
|
| 256 |
0 |
| return sv;
|
| 257 |
|
| }
|
| 258 |
|
|
|
| 259 |
0 |
| SV* new_sv_sass_boolean (SV* boolean) {
|
| 260 |
0 |
| SV* sv = newRV_noinc(newRV_noinc(boolean));
|
| 261 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::Boolean", GV_ADD));
|
| 262 |
0 |
| return sv;
|
| 263 |
|
| }
|
| 264 |
|
|
|
| 265 |
0 |
| SV* new_sv_sass_number (SV* number, SV* unit) {
|
| 266 |
0 |
| AV* array = newAV();
|
| 267 |
0 |
| av_push(array, number);
|
| 268 |
0 |
| av_push(array, unit);
|
| 269 |
0 |
| SV* sv = newRV_noinc(newRV_noinc((SV*) array));
|
| 270 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::Number", GV_ADD));
|
| 271 |
0 |
| return sv;
|
| 272 |
|
| }
|
| 273 |
|
|
|
| 274 |
0 |
| SV* new_sv_sass_color (SV* r, SV* g, SV* b, SV* a) {
|
| 275 |
0 |
| HV* hash = newHV();
|
| 276 |
0 |
| (void)hv_store(hash, "r", 1, r, 0);
|
| 277 |
0 |
| (void)hv_store(hash, "g", 1, g, 0);
|
| 278 |
0 |
| (void)hv_store(hash, "b", 1, b, 0);
|
| 279 |
0 |
| (void)hv_store(hash, "a", 1, a, 0);
|
| 280 |
0 |
| SV* sv = newRV_noinc(newRV_noinc((SV*) hash));
|
| 281 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::Color", GV_ADD));
|
| 282 |
0 |
| return sv;
|
| 283 |
|
| }
|
| 284 |
|
|
|
| 285 |
0 |
| SV* new_sv_sass_error (SV* msg) {
|
| 286 |
0 |
| AV* error = newAV();
|
| 287 |
0 |
| av_push(error, msg);
|
| 288 |
0 |
| SV* sv = newRV_noinc(newRV_noinc(newRV_noinc((SV*) error)));
|
| 289 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::Error", GV_ADD));
|
| 290 |
0 |
| return sv;
|
| 291 |
|
| }
|
| 292 |
|
|
|
| 293 |
|
| // convert from libsass to perl
|
| 294 |
0 |
| SV* sass_value_to_sv(union Sass_Value* val)
|
| 295 |
|
| {
|
| 296 |
|
| SV* sv;
|
| 297 |
0 |
| switch(sass_value_get_tag(val)) {
|
| 298 |
0 |
| case SASS_NULL: {
|
| 299 |
0 |
| sv = new_sv_sass_null();
|
| 300 |
0 |
| } break;
|
| 301 |
0 |
| case SASS_BOOLEAN: {
|
| 302 |
0 |
| sv = new_sv_sass_boolean(
|
| 303 |
0 |
| newSViv(sass_boolean_get_value(val))
|
| 304 |
|
| );
|
| 305 |
0 |
| } break;
|
| 306 |
0 |
| case SASS_NUMBER: {
|
| 307 |
0 |
| sv = new_sv_sass_number(
|
| 308 |
|
| newSVnv(sass_number_get_value(val)),
|
| 309 |
|
| newSVpv(sass_number_get_unit(val), 0)
|
| 310 |
|
| );
|
| 311 |
0 |
| } break;
|
| 312 |
0 |
| case SASS_COLOR: {
|
| 313 |
0 |
| sv = new_sv_sass_color(
|
| 314 |
|
| newSVnv(sass_color_get_r(val)),
|
| 315 |
|
| newSVnv(sass_color_get_g(val)),
|
| 316 |
|
| newSVnv(sass_color_get_b(val)),
|
| 317 |
|
| newSVnv(sass_color_get_a(val))
|
| 318 |
|
| );
|
| 319 |
0 |
| } break;
|
| 320 |
0 |
| case SASS_STRING: {
|
| 321 |
0 |
| sv = new_sv_sass_string(
|
| 322 |
|
| newSVpv(sass_string_get_value(val), 0),
|
| 323 |
|
| false
|
| 324 |
|
| );
|
| 325 |
0 |
| } break;
|
| 326 |
0 |
| case SASS_LIST: {
|
| 327 |
|
| size_t i;
|
| 328 |
0 |
| AV* list = newAV();
|
| 329 |
0 |
| sv = newRV_noinc((SV*) list);
|
| 330 |
0 |
▶ | if (sass_list_get_separator(val) == SASS_SPACE) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sass_list_get_separator(val) == SASS_SPACE) {
|
0 |
0 |
0 |
|
| 331 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::List::Space", GV_ADD));
|
| 332 |
|
| } else {
|
| 333 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::List::Comma", GV_ADD));
|
| 334 |
|
| }
|
| 335 |
0 |
▶ | for (i=0; i<sass_list_get_length(val); i++)
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i=0; i<sass_list_get_length(val); i++)
|
0 |
0 |
0 |
|
| 336 |
0 |
| av_push(list, sass_value_to_sv(sass_list_get_value(val, i)));
|
| 337 |
0 |
| } break;
|
| 338 |
0 |
| case SASS_MAP: {
|
| 339 |
|
| size_t i;
|
| 340 |
0 |
| HV* map = newHV();
|
| 341 |
0 |
| sv = newRV_noinc((SV*) map);
|
| 342 |
0 |
| sv_bless(sv, gv_stashpv("CSS::Sass::Value::Map", GV_ADD));
|
| 343 |
0 |
▶ | for (i=0; i<sass_map_get_length(val); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i=0; i<sass_map_get_length(val); i++) {
|
0 |
0 |
0 |
|
| 344 |
|
| // this should return a scalar sv
|
| 345 |
0 |
| union Sass_Value* key = sass_map_get_key(val, i);
|
| 346 |
0 |
| SV* sv_key = sass_value_to_sv(key);
|
| 347 |
|
| // call us recursive if needed to get sass values
|
| 348 |
0 |
| union Sass_Value* value = sass_map_get_value(val, i);
|
| 349 |
0 |
| SV* sv_value = sass_value_to_sv(value);
|
| 350 |
|
| // store the key/value pair on the hash
|
| 351 |
0 |
| (void)hv_store_ent(map, sv_key, sv_value, 0);
|
| 352 |
|
| // make key sv mortal
|
| 353 |
0 |
| sv_2mortal(sv_key);
|
| 354 |
|
| }
|
| 355 |
0 |
| } break;
|
| 356 |
0 |
| case SASS_ERROR: {
|
| 357 |
0 |
| sv = new_sv_sass_error(
|
| 358 |
0 |
| newSVpv(sass_error_get_message(val), 0)
|
| 359 |
|
| );
|
| 360 |
0 |
| } break;
|
| 361 |
0 |
| default:
|
| 362 |
0 |
| sv = new_sv_sass_error(
|
| 363 |
0 |
| newSVpvf("BUG: Sass_Value type is unknown (%d)", sass_value_get_tag(val))
|
| 364 |
|
| );
|
| 365 |
0 |
| break;
|
| 366 |
|
| }
|
| 367 |
|
|
|
| 368 |
0 |
| return sv;
|
| 369 |
|
| }
|
| 370 |
|
|
|
| 371 |
|
|
|
| 372 |
0 |
| Sass_Import_List sass_importer(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
|
| 373 |
|
| {
|
| 374 |
|
|
|
| 375 |
0 |
| dSP;
|
| 376 |
|
| // value from perl function
|
| 377 |
0 |
| SV* perl_value = NULL;
|
| 378 |
|
| // value to return to libsass
|
| 379 |
|
| // union Sass_Value* sass_value = NULL;
|
| 380 |
|
|
|
| 381 |
0 |
| ENTER;
|
| 382 |
0 |
| SAVETMPS;
|
| 383 |
|
|
|
| 384 |
0 |
| void* cookie = sass_importer_get_cookie(cb);
|
| 385 |
0 |
| struct Sass_Import* previous = sass_compiler_get_last_import(comp);
|
| 386 |
0 |
| const char* prev_abs_path = sass_import_get_abs_path(previous);
|
| 387 |
0 |
| const char* prev_imp_path = sass_import_get_imp_path(previous);
|
| 388 |
|
|
|
| 389 |
0 |
▶ | PUSHMARK(SP);
|
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP);
|
0 |
0 |
0 |
|
| 390 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv(cur_path, 0)));
|
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(cur_path, 0)));
|
0 |
0 |
0 |
|
| 391 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv(prev_abs_path, 0)));
|
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(prev_abs_path, 0)));
|
0 |
0 |
0 |
|
| 392 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv(prev_imp_path, 0)));
|
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(prev_imp_path, 0)));
|
0 |
0 |
0 |
|
| 393 |
0 |
| PUTBACK;
|
| 394 |
|
|
|
| 395 |
|
| // call the static function by soft name reference
|
| 396 |
|
| // force array context since we want to check for errors
|
| 397 |
|
| // in scalar context it would take the last value from list
|
| 398 |
|
| // also enable eval context to catch any major problems
|
| 399 |
0 |
| int count = call_sv(cookie, G_EVAL | G_ARRAY);
|
| 400 |
|
|
|
| 401 |
0 |
| SPAGAIN;
|
| 402 |
0 |
▶ | if (!SvTRUE(ERRSV)) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
| if (!SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
|
| 403 |
0 |
▶ | if (count == 0)
|
Branch: 1 branch
| Branch | True | False | Total |
| if (count == 0)
|
0 |
0 |
0 |
|
| 404 |
0 |
| perl_value = &PL_sv_undef;
|
| 405 |
0 |
▶ | else if (count == 1)
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (count == 1)
|
0 |
0 |
0 |
|
| 406 |
0 |
| perl_value = POPs;
|
| 407 |
|
| }
|
| 408 |
|
|
|
| 409 |
|
| // dereference if possible
|
| 410 |
0 |
▶ | if (perl_value && SvROK(perl_value)) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (perl_value && SvROK(perl_value)) {
|
0 |
0 |
0 |
| if (perl_value && SvROK(perl_value)) {
|
0 |
0 |
0 |
|
| 411 |
0 |
| perl_value = SvRV(perl_value);
|
| 412 |
|
| }
|
| 413 |
|
|
|
| 414 |
0 |
| size_t len = 0;
|
| 415 |
0 |
| struct Sass_Import** incs = 0;
|
| 416 |
|
|
|
| 417 |
0 |
▶ | if (SvTRUE(ERRSV)) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
| if (SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
|
| 418 |
0 |
▶ | char* message = SvPV_nolen(ERRSV);
|
Branch: 1 branch
| Branch | True | False | Total |
| char* message = SvPV_nolen(ERRSV);
|
0 |
0 |
0 |
|
| 419 |
0 |
| incs = sass_make_import_list(1);
|
| 420 |
0 |
| incs[0] = sass_make_import_entry(0, 0, 0);
|
| 421 |
0 |
| sass_import_set_error(incs[0], message, -1, -1);
|
| 422 |
|
| }
|
| 423 |
|
|
|
| 424 |
|
| // do nothing if we got undef retuned
|
| 425 |
0 |
▶ | else if (SvTYPE(perl_value) == SVt_NULL) { }
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(perl_value) == SVt_NULL) { }
|
0 |
0 |
0 |
|
| 426 |
|
| // we may have gotten a single path
|
| 427 |
0 |
▶ | else if (SvTYPE(perl_value) < SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(perl_value) < SVt_PVAV) {
|
0 |
0 |
0 |
|
| 428 |
|
|
|
| 429 |
|
| // try to load the filename
|
| 430 |
0 |
| incs = sass_make_import_list(1);
|
| 431 |
0 |
| char* path = SvPV_nolen(perl_value);
|
| 432 |
0 |
| incs[0] = sass_make_import_entry(path, 0, 0);
|
| 433 |
|
|
|
| 434 |
|
| }
|
| 435 |
|
| // the expected type is an array
|
| 436 |
0 |
▶ | else if (SvTYPE(perl_value) == SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(perl_value) == SVt_PVAV) {
|
0 |
0 |
0 |
|
| 437 |
|
|
|
| 438 |
|
| int i;
|
| 439 |
0 |
| AV* sass_imports_av = (AV*) perl_value;
|
| 440 |
0 |
| size_t length = av_len(sass_imports_av);
|
| 441 |
0 |
| incs = sass_make_import_list(length + 1);
|
| 442 |
|
|
|
| 443 |
|
| // process all import statements returned by perl
|
| 444 |
0 |
▶ | for (i = 0; i <= av_len(sass_imports_av); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= av_len(sass_imports_av); i++) {
|
0 |
0 |
0 |
|
| 445 |
|
|
|
| 446 |
0 |
| char* path = 0;
|
| 447 |
0 |
| char* source = 0;
|
| 448 |
0 |
| char* mapjson = 0;
|
| 449 |
0 |
| char* error_msg = 0;
|
| 450 |
0 |
| size_t error_line = -1;
|
| 451 |
0 |
| size_t error_column = -1;
|
| 452 |
|
|
|
| 453 |
|
| // get the entry from the array
|
| 454 |
|
| // can either be another array or a path string
|
| 455 |
0 |
| SV** import_svp = av_fetch(sass_imports_av, i, false);
|
| 456 |
|
|
|
| 457 |
|
| // error fetching entry?
|
| 458 |
0 |
▶ | if (!import_svp) continue;
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!import_svp) continue;
|
0 |
0 |
0 |
|
| 459 |
|
|
|
| 460 |
0 |
| SV* import_sv = *import_svp;
|
| 461 |
|
|
|
| 462 |
|
| // dereference if possible
|
| 463 |
0 |
▶ | if (SvROK(import_sv)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(import_sv)) {
|
0 |
0 |
0 |
|
| 464 |
0 |
| import_sv = SvRV(import_sv);
|
| 465 |
|
| }
|
| 466 |
|
|
|
| 467 |
|
| // we may have gotten a single path
|
| 468 |
0 |
▶ | if (SvTYPE(import_sv) < SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(import_sv) < SVt_PVAV) {
|
0 |
0 |
0 |
|
| 469 |
0 |
| path = SvPV_nolen(import_sv);
|
| 470 |
|
| }
|
| 471 |
|
| // the expected type is an array
|
| 472 |
0 |
▶ | else if (SvTYPE(import_sv) == SVt_PVAV) {
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (SvTYPE(import_sv) == SVt_PVAV) {
|
0 |
0 |
0 |
|
| 473 |
0 |
| AV* import_av = (AV*) import_sv;
|
| 474 |
0 |
| int len = av_len(import_av);
|
| 475 |
0 |
▶ | SV** path_sv = len < 0 ? 0 : av_fetch(import_av, 0, false);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV** path_sv = len < 0 ? 0 : av_fetch(import_av, 0, false);
|
0 |
0 |
0 |
|
| 476 |
0 |
▶ | SV** source_sv = len < 1 ? 0 : av_fetch(import_av, 1, false);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV** source_sv = len < 1 ? 0 : av_fetch(import_av, 1, false);
|
0 |
0 |
0 |
|
| 477 |
0 |
▶ | SV** mapjson_sv = len < 2 ? 0 : av_fetch(import_av, 2, false);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV** mapjson_sv = len < 2 ? 0 : av_fetch(import_av, 2, false);
|
0 |
0 |
0 |
|
| 478 |
0 |
▶ | SV** error_msg_sv = len < 3 ? 0 : av_fetch(import_av, 3, false);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV** error_msg_sv = len < 3 ? 0 : av_fetch(import_av, 3, false);
|
0 |
0 |
0 |
|
| 479 |
0 |
▶ | SV** error_line_sv = len < 4 ? 0 : av_fetch(import_av, 4, false);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV** error_line_sv = len < 4 ? 0 : av_fetch(import_av, 4, false);
|
0 |
0 |
0 |
|
| 480 |
0 |
▶ | SV** error_column_sv = len < 5 ? 0 : av_fetch(import_av, 5, false);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV** error_column_sv = len < 5 ? 0 : av_fetch(import_av, 5, false);
|
0 |
0 |
0 |
|
| 481 |
0 |
▶ | if (path_sv && SvOK(*path_sv)) path = SvPV_nolen(*path_sv);
|
Branch: 2 branches
| Branch | True | False | Total |
| if (path_sv && SvOK(*path_sv)) path = SvPV_nolen(*path_sv);
|
0 |
0 |
0 |
| if (path_sv && SvOK(*path_sv)) path = SvPV_nolen(*path_sv);
|
0 |
0 |
0 |
|
| 482 |
0 |
▶ | if (source_sv && SvOK(*source_sv)) source = SvPV_nolen(*source_sv);
|
Branch: 2 branches
| Branch | True | False | Total |
| if (source_sv && SvOK(*source_sv)) source = SvPV_nolen(*source_sv);
|
0 |
0 |
0 |
| if (source_sv && SvOK(*source_sv)) source = SvPV_nolen(*source_sv);
|
0 |
0 |
0 |
|
| 483 |
0 |
▶ | if (mapjson_sv && SvOK(*mapjson_sv)) mapjson = SvPV_nolen(*mapjson_sv);
|
Branch: 2 branches
| Branch | True | False | Total |
| if (mapjson_sv && SvOK(*mapjson_sv)) mapjson = SvPV_nolen(*mapjson_sv);
|
0 |
0 |
0 |
| if (mapjson_sv && SvOK(*mapjson_sv)) mapjson = SvPV_nolen(*mapjson_sv);
|
0 |
0 |
0 |
|
| 484 |
0 |
▶ | if (error_msg_sv && SvOK(*error_msg_sv)) error_msg = SvPV_nolen(*error_msg_sv);
|
Branch: 2 branches
| Branch | True | False | Total |
| if (error_msg_sv && SvOK(*error_msg_sv)) error_msg = SvPV_nolen(*error_msg_sv);
|
0 |
0 |
0 |
| if (error_msg_sv && SvOK(*error_msg_sv)) error_msg = SvPV_nolen(*error_msg_sv);
|
0 |
0 |
0 |
|
| 485 |
0 |
▶ | if (error_line_sv && SvOK(*error_line_sv)) error_line = SvNV(*error_line_sv);
|
Branch: 2 branches
| Branch | True | False | Total |
| if (error_line_sv && SvOK(*error_line_sv)) error_line = SvNV(*error_line_sv);
|
0 |
0 |
0 |
| if (error_line_sv && SvOK(*error_line_sv)) error_line = SvNV(*error_line_sv);
|
0 |
0 |
0 |
|
| 486 |
0 |
▶ | if (error_column_sv && SvOK(*error_column_sv)) error_column = SvNV(*error_column_sv);
|
Branch: 2 branches
| Branch | True | False | Total |
| if (error_column_sv && SvOK(*error_column_sv)) error_column = SvNV(*error_column_sv);
|
0 |
0 |
0 |
| if (error_column_sv && SvOK(*error_column_sv)) error_column = SvNV(*error_column_sv);
|
0 |
0 |
0 |
|
| 487 |
|
| }
|
| 488 |
|
| // error
|
| 489 |
|
| else {
|
| 490 |
|
| // output a warning to inform the implementer of his mischief
|
| 491 |
|
| // vwarn seems to have a bug (expects char** but needs char***)
|
| 492 |
0 |
| vwarn("Importer returned invalid data type", 0);
|
| 493 |
|
| }
|
| 494 |
|
|
|
| 495 |
|
| // check valid import statement
|
| 496 |
0 |
▶ | if (!path && !source) continue;
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!path && !source) continue;
|
0 |
0 |
0 |
| if (!path && !source) continue;
|
0 |
0 |
0 |
|
| 497 |
|
| // push new import on to the importer list
|
| 498 |
|
| // need to make copy of blobs handled by perl
|
| 499 |
0 |
▶ | char* cp_source = source ? strdup(source) : 0;
|
Branch: 1 branch
| Branch | True | False | Total |
| char* cp_source = source ? strdup(source) : 0;
|
0 |
0 |
0 |
|
| 500 |
0 |
▶ | char* cp_mapjson = mapjson ? strdup(mapjson) : 0;
|
Branch: 1 branch
| Branch | True | False | Total |
| char* cp_mapjson = mapjson ? strdup(mapjson) : 0;
|
0 |
0 |
0 |
|
| 501 |
0 |
| incs[len] = sass_make_import_entry(path, cp_source, cp_mapjson);
|
| 502 |
0 |
▶ | if (error_msg && strlen(error_msg) > 0) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (error_msg && strlen(error_msg) > 0) {
|
0 |
0 |
0 |
| if (error_msg && strlen(error_msg) > 0) {
|
0 |
0 |
0 |
|
| 503 |
0 |
| sass_import_set_error(incs[len], error_msg, error_line, error_column);
|
| 504 |
|
| }
|
| 505 |
0 |
| ++len;
|
| 506 |
|
| }
|
| 507 |
|
| // EO each SV in AV
|
| 508 |
|
|
|
| 509 |
|
| }
|
| 510 |
|
| // error
|
| 511 |
|
| else {
|
| 512 |
|
| // output a warning to inform the implementer of his mischief
|
| 513 |
|
| // vwarn seems to have a bug (expects char** but needs char***)
|
| 514 |
0 |
| vwarn("Importer returned invalid data type", 0);
|
| 515 |
|
| }
|
| 516 |
|
|
|
| 517 |
0 |
| PUTBACK;
|
| 518 |
0 |
▶ | FREETMPS;
|
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS;
|
0 |
0 |
0 |
|
| 519 |
0 |
| LEAVE;
|
| 520 |
|
|
|
| 521 |
0 |
| return incs;
|
| 522 |
|
|
|
| 523 |
|
| }
|
| 524 |
|
|
|
| 525 |
|
| // we are called by libsass to dispatch to registered functions
|
| 526 |
0 |
| union Sass_Value* call_sass_function(const union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Compiler* comp)
|
| 527 |
|
| {
|
| 528 |
|
|
|
| 529 |
0 |
| dSP;
|
| 530 |
|
| // value from perl function
|
| 531 |
0 |
| SV* perl_value = NULL;
|
| 532 |
|
| // value to return to libsass
|
| 533 |
0 |
| union Sass_Value* sass_value = NULL;
|
| 534 |
|
| size_t i;
|
| 535 |
|
|
|
| 536 |
0 |
| ENTER;
|
| 537 |
0 |
| SAVETMPS;
|
| 538 |
|
|
|
| 539 |
0 |
| void* cookie = sass_function_get_cookie(cb);
|
| 540 |
|
|
|
| 541 |
0 |
▶ | PUSHMARK(SP);
|
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP);
|
0 |
0 |
0 |
|
| 542 |
0 |
▶ | for (i=0; i<sass_list_get_length(s_args); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i=0; i<sass_list_get_length(s_args); i++) {
|
0 |
0 |
0 |
|
| 543 |
|
| // get the Sass_Value from libsass
|
| 544 |
0 |
| union Sass_Value* arg = sass_list_get_value(s_args, i);
|
| 545 |
|
| // convert and add argument for perl
|
| 546 |
0 |
▶ | XPUSHs(sv_2mortal(sass_value_to_sv(arg)));
|
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(sass_value_to_sv(arg)));
|
0 |
0 |
0 |
|
| 547 |
|
| }
|
| 548 |
0 |
| PUTBACK;
|
| 549 |
|
|
|
| 550 |
|
| // free input values
|
| 551 |
|
| // free_sass_value(s_args);
|
| 552 |
|
|
|
| 553 |
|
| // call the static function by soft name reference
|
| 554 |
|
| // force array context since we want to check for errors
|
| 555 |
|
| // in scalar context it would take the last value from list
|
| 556 |
|
| // also enable eval context to catch any major problems
|
| 557 |
0 |
| int count = call_sv(cookie, G_EVAL | G_ARRAY);
|
| 558 |
|
|
|
| 559 |
0 |
| SPAGAIN;
|
| 560 |
0 |
▶ | if (!SvTRUE(ERRSV)) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
| if (!SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
|
| 561 |
0 |
▶ | if (count == 0)
|
Branch: 1 branch
| Branch | True | False | Total |
| if (count == 0)
|
0 |
0 |
0 |
|
| 562 |
0 |
| perl_value = &PL_sv_undef;
|
| 563 |
0 |
▶ | else if (count == 1)
|
Branch: 1 branch
| Branch | True | False | Total |
| else if (count == 1)
|
0 |
0 |
0 |
|
| 564 |
0 |
| perl_value = POPs;
|
| 565 |
|
| }
|
| 566 |
|
|
|
| 567 |
0 |
▶ | if (SvTRUE(ERRSV)) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
| if (SvTRUE(ERRSV)) {
|
0 |
0 |
0 |
|
| 568 |
|
| // perl function died or had some other major problem
|
| 569 |
0 |
▶ | sass_value = sass_make_error_f("%s:%d %s: Perl sub died with message: %s!\n", __FILE__, __LINE__, __func__, SvPV_nolen(ERRSV));
|
Branch: 1 branch
| Branch | True | False | Total |
| sass_value = sass_make_error_f("%s:%d %s: Perl sub died with message: %s!\n", __FILE__, __LINE__, __func__, SvPV_nolen(ERRSV));
|
0 |
0 |
0 |
|
| 570 |
0 |
▶ | } else if (count > 1) {
|
Branch: 1 branch
| Branch | True | False | Total |
| } else if (count > 1) {
|
0 |
0 |
0 |
|
| 571 |
|
| // perl function returned a list of values (undefined behaviour)
|
| 572 |
0 |
| sass_value = sass_make_error_f("%s:%d %s: Perl sub must not return a list of values!\n", __FILE__, __LINE__, __func__);
|
| 573 |
|
| } else {
|
| 574 |
|
| // convert returned sv to Sass_Value
|
| 575 |
0 |
| sass_value = sv_to_sass_value(perl_value);
|
| 576 |
|
| }
|
| 577 |
|
|
|
| 578 |
0 |
| PUTBACK;
|
| 579 |
0 |
▶ | FREETMPS;
|
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS;
|
0 |
0 |
0 |
|
| 580 |
0 |
| LEAVE;
|
| 581 |
|
|
|
| 582 |
|
| // union Sass_Value
|
| 583 |
0 |
| return sass_value;
|
| 584 |
|
|
|
| 585 |
|
| }
|
| 586 |
|
|
|
| 587 |
0 |
| SV* init_sass_options(struct Sass_Options* sass_options, HV* perl_options)
|
| 588 |
|
| {
|
| 589 |
|
|
|
| 590 |
0 |
| SV** input_path_sv = hv_fetchs(perl_options, "input_path", false);
|
| 591 |
0 |
| SV** output_path_sv = hv_fetchs(perl_options, "output_path", false);
|
| 592 |
0 |
| SV** output_style_sv = hv_fetchs(perl_options, "output_style", false);
|
| 593 |
0 |
| SV** source_comments_sv = hv_fetchs(perl_options, "source_comments", false);
|
| 594 |
0 |
| SV** omit_source_map_sv = hv_fetchs(perl_options, "omit_source_map", false);
|
| 595 |
0 |
| SV** omit_source_map_url_sv = hv_fetchs(perl_options, "omit_source_map_url", false);
|
| 596 |
0 |
| SV** source_map_file_urls_sv = hv_fetchs(perl_options, "source_map_file_urls", false);
|
| 597 |
0 |
| SV** source_map_contents_sv = hv_fetchs(perl_options, "source_map_contents", false);
|
| 598 |
0 |
| SV** source_map_embed_sv = hv_fetchs(perl_options, "source_map_embed", false);
|
| 599 |
0 |
| SV** include_paths_sv = hv_fetchs(perl_options, "include_paths", false);
|
| 600 |
0 |
| SV** plugin_paths_sv = hv_fetchs(perl_options, "plugin_paths", false);
|
| 601 |
0 |
| SV** precision_sv = hv_fetchs(perl_options, "precision", false);
|
| 602 |
0 |
| SV** linefeed_sv = hv_fetchs(perl_options, "linefeed", false);
|
| 603 |
0 |
| SV** indent_sv = hv_fetchs(perl_options, "indent", false);
|
| 604 |
0 |
| SV** source_map_root_sv = hv_fetchs(perl_options, "source_map_root", false);
|
| 605 |
0 |
| SV** source_map_file_sv = hv_fetchs(perl_options, "source_map_file", false);
|
| 606 |
0 |
| SV** sass_headers_sv = hv_fetchs(perl_options, "headers", false);
|
| 607 |
0 |
| SV** sass_importers_sv = hv_fetchs(perl_options, "importers", false);
|
| 608 |
0 |
| SV** sass_functions_sv = hv_fetchs(perl_options, "functions", false);
|
| 609 |
|
|
|
| 610 |
0 |
▶ | if (input_path_sv) sass_option_set_input_path (sass_options, safe_svpv(*input_path_sv, ""));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (input_path_sv) sass_option_set_input_path (sass_options, safe_svpv(*input_path_sv, ""));
|
0 |
0 |
0 |
|
| 611 |
0 |
▶ | if (output_path_sv) sass_option_set_output_path (sass_options, safe_svpv(*output_path_sv, ""));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (output_path_sv) sass_option_set_output_path (sass_options, safe_svpv(*output_path_sv, ""));
|
0 |
0 |
0 |
|
| 612 |
0 |
▶ | if (output_style_sv) sass_option_set_output_style (sass_options, SvUV(*output_style_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (output_style_sv) sass_option_set_output_style (sass_options, SvUV(*output_style_sv));
|
0 |
0 |
0 |
|
| 613 |
0 |
▶ | if (source_comments_sv) sass_option_set_source_comments (sass_options, SvTRUE(*source_comments_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (source_comments_sv) sass_option_set_source_comments (sass_options, SvTRUE(*source_comments_sv));
|
0 |
0 |
0 |
|
| 614 |
0 |
▶ | if (omit_source_map_sv) sass_option_set_omit_source_map_url (sass_options, SvTRUE(*omit_source_map_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (omit_source_map_sv) sass_option_set_omit_source_map_url (sass_options, SvTRUE(*omit_source_map_sv));
|
0 |
0 |
0 |
|
| 615 |
0 |
▶ | if (omit_source_map_url_sv) sass_option_set_omit_source_map_url (sass_options, SvTRUE(*omit_source_map_url_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (omit_source_map_url_sv) sass_option_set_omit_source_map_url (sass_options, SvTRUE(*omit_source_map_url_sv));
|
0 |
0 |
0 |
|
| 616 |
0 |
▶ | if (source_map_file_urls_sv) sass_option_set_source_map_file_urls (sass_options, SvTRUE(*source_map_file_urls_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (source_map_file_urls_sv) sass_option_set_source_map_file_urls (sass_options, SvTRUE(*source_map_file_urls_sv));
|
0 |
0 |
0 |
|
| 617 |
0 |
▶ | if (source_map_contents_sv) sass_option_set_source_map_contents (sass_options, SvTRUE(*source_map_contents_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (source_map_contents_sv) sass_option_set_source_map_contents (sass_options, SvTRUE(*source_map_contents_sv));
|
0 |
0 |
0 |
|
| 618 |
0 |
▶ | if (source_map_embed_sv) sass_option_set_source_map_embed (sass_options, SvTRUE(*source_map_embed_sv));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (source_map_embed_sv) sass_option_set_source_map_embed (sass_options, SvTRUE(*source_map_embed_sv));
|
0 |
0 |
0 |
|
| 619 |
0 |
▶ | if (include_paths_sv) sass_option_set_include_path (sass_options, safe_svpv(*include_paths_sv, ""));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (include_paths_sv) sass_option_set_include_path (sass_options, safe_svpv(*include_paths_sv, ""));
|
0 |
0 |
0 |
|
| 620 |
0 |
▶ | if (plugin_paths_sv) sass_option_set_plugin_path (sass_options, safe_svpv(*plugin_paths_sv, ""));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (plugin_paths_sv) sass_option_set_plugin_path (sass_options, safe_svpv(*plugin_paths_sv, ""));
|
0 |
0 |
0 |
|
| 621 |
0 |
▶ | if (source_map_root_sv) sass_option_set_source_map_root (sass_options, safe_svpv(*source_map_root_sv, ""));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (source_map_root_sv) sass_option_set_source_map_root (sass_options, safe_svpv(*source_map_root_sv, ""));
|
0 |
0 |
0 |
|
| 622 |
0 |
▶ | if (source_map_file_sv) sass_option_set_source_map_file (sass_options, safe_svpv(*source_map_file_sv, ""));
|
Branch: 1 branch
| Branch | True | False | Total |
| if (source_map_file_sv) sass_option_set_source_map_file (sass_options, safe_svpv(*source_map_file_sv, ""));
|
0 |
0 |
0 |
|
| 623 |
|
|
|
| 624 |
|
| // do not set anything if the option is set to undef
|
| 625 |
0 |
▶ | if (isSafeSv(indent_sv)) sass_option_set_indent (sass_options, SvPV_nolen(*indent_sv));
|
Branch: 2 branches
| Branch | True | False | Total |
| if (isSafeSv(indent_sv)) sass_option_set_indent (sass_options, SvPV_nolen(*indent_sv));
|
0 |
0 |
0 |
| if (isSafeSv(indent_sv)) sass_option_set_indent (sass_options, SvPV_nolen(*indent_sv));
|
0 |
0 |
0 |
|
| 626 |
0 |
▶ | if (isSafeSv(linefeed_sv)) sass_option_set_linefeed (sass_options, SvPV_nolen(*linefeed_sv));
|
Branch: 2 branches
| Branch | True | False | Total |
| if (isSafeSv(linefeed_sv)) sass_option_set_linefeed (sass_options, SvPV_nolen(*linefeed_sv));
|
0 |
0 |
0 |
| if (isSafeSv(linefeed_sv)) sass_option_set_linefeed (sass_options, SvPV_nolen(*linefeed_sv));
|
0 |
0 |
0 |
|
| 627 |
0 |
▶ | if (isSafeSv(precision_sv)) sass_option_set_precision (sass_options, SvUV(*precision_sv));
|
Branch: 2 branches
| Branch | True | False | Total |
| if (isSafeSv(precision_sv)) sass_option_set_precision (sass_options, SvUV(*precision_sv));
|
0 |
0 |
0 |
| if (isSafeSv(precision_sv)) sass_option_set_precision (sass_options, SvUV(*precision_sv));
|
0 |
0 |
0 |
|
| 628 |
|
|
|
| 629 |
0 |
▶ | if (sass_importers_sv) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sass_importers_sv) {
|
0 |
0 |
0 |
|
| 630 |
|
| int i;
|
| 631 |
|
| AV* sass_importers_av;
|
| 632 |
0 |
▶ | if (!SvROK(*sass_importers_sv) || SvTYPE(SvRV(*sass_importers_sv)) != SVt_PVAV) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(*sass_importers_sv) || SvTYPE(SvRV(*sass_importers_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
| if (!SvROK(*sass_importers_sv) || SvTYPE(SvRV(*sass_importers_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
|
| 633 |
0 |
| return newSVpvf("sass_importers should be an arrayref (SvTYPE=%u)", (unsigned)SvTYPE(SvRV(*sass_importers_sv)));
|
| 634 |
|
| }
|
| 635 |
0 |
| sass_importers_av = (AV*)SvRV(*sass_importers_sv);
|
| 636 |
|
|
|
| 637 |
0 |
| Sass_Importer_List c_importers = sass_make_importer_list(av_len(sass_importers_av) + 1);
|
| 638 |
|
|
|
| 639 |
0 |
▶ | if (!c_importers) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!c_importers) {
|
0 |
0 |
0 |
|
| 640 |
0 |
| return newSVpv("couldn't alloc memory for c_importers", 0);
|
| 641 |
|
| }
|
| 642 |
0 |
▶ | for (i=0; i<=av_len(sass_importers_av); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i=0; i<=av_len(sass_importers_av); i++) {
|
0 |
0 |
0 |
|
| 643 |
0 |
| SV** entry_sv = av_fetch(sass_importers_av, i, false);
|
| 644 |
|
| AV* entry_av;
|
| 645 |
0 |
▶ | if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
| if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
|
| 646 |
0 |
| return newSVpvf("each sass_importer entry should be an arrayref (SvTYPE=%u)", (unsigned)SvTYPE(SvRV(*entry_sv)));
|
| 647 |
|
| }
|
| 648 |
0 |
| entry_av = (AV*)SvRV(*entry_sv);
|
| 649 |
|
|
|
| 650 |
0 |
| SV** importer_sv = av_fetch(entry_av, 0, false);
|
| 651 |
0 |
| SV** priority_sv = av_fetch(entry_av, 1, false);
|
| 652 |
0 |
▶ | double priority = priority_sv ? SvNV(*priority_sv) : 0;
|
Branch: 1 branch
| Branch | True | False | Total |
| double priority = priority_sv ? SvNV(*priority_sv) : 0;
|
0 |
0 |
0 |
|
| 653 |
0 |
▶ | if (!importer_sv) return newSVpv("custom importer without callback", 0);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!importer_sv) return newSVpv("custom importer without callback", 0);
|
0 |
0 |
0 |
|
| 654 |
0 |
| c_importers[i] = sass_make_importer(sass_importer, priority, *importer_sv);
|
| 655 |
|
| }
|
| 656 |
|
|
|
| 657 |
0 |
| sass_option_set_c_importers(sass_options, c_importers);
|
| 658 |
|
| }
|
| 659 |
|
|
|
| 660 |
0 |
▶ | if (sass_headers_sv) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sass_headers_sv) {
|
0 |
0 |
0 |
|
| 661 |
|
| int i;
|
| 662 |
|
| AV* sass_headers_av;
|
| 663 |
0 |
▶ | if (!SvROK(*sass_headers_sv) || SvTYPE(SvRV(*sass_headers_sv)) != SVt_PVAV) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(*sass_headers_sv) || SvTYPE(SvRV(*sass_headers_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
| if (!SvROK(*sass_headers_sv) || SvTYPE(SvRV(*sass_headers_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
|
| 664 |
0 |
| return newSVpvf("sass_headers should be an arrayref (SvTYPE=%u)", (unsigned)SvTYPE(SvRV(*sass_headers_sv)));
|
| 665 |
|
| }
|
| 666 |
0 |
| sass_headers_av = (AV*)SvRV(*sass_headers_sv);
|
| 667 |
|
|
|
| 668 |
0 |
| Sass_Importer_List c_headers = sass_make_importer_list(av_len(sass_headers_av) + 1);
|
| 669 |
|
|
|
| 670 |
0 |
▶ | if (!c_headers) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!c_headers) {
|
0 |
0 |
0 |
|
| 671 |
0 |
| return newSVpv("couldn't alloc memory for c_headers", 0);
|
| 672 |
|
| }
|
| 673 |
0 |
▶ | for (i=0; i<=av_len(sass_headers_av); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i=0; i<=av_len(sass_headers_av); i++) {
|
0 |
0 |
0 |
|
| 674 |
0 |
| SV** entry_sv = av_fetch(sass_headers_av, i, false);
|
| 675 |
|
| AV* entry_av;
|
| 676 |
0 |
▶ | if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
| if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
|
| 677 |
0 |
| return newSVpvf("each sass_header entry should be an arrayref (SvTYPE=%u)", (unsigned)SvTYPE(SvRV(*entry_sv)));
|
| 678 |
|
| }
|
| 679 |
0 |
| entry_av = (AV*)SvRV(*entry_sv);
|
| 680 |
|
|
|
| 681 |
0 |
| SV** header_sv = av_fetch(entry_av, 0, false);
|
| 682 |
0 |
| SV** priority_sv = av_fetch(entry_av, 1, false);
|
| 683 |
0 |
▶ | double priority = priority_sv ? SvNV(*priority_sv) : 0;
|
Branch: 1 branch
| Branch | True | False | Total |
| double priority = priority_sv ? SvNV(*priority_sv) : 0;
|
0 |
0 |
0 |
|
| 684 |
0 |
▶ | if (!header_sv) return newSVpv("custom header without callback", 0);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!header_sv) return newSVpv("custom header without callback", 0);
|
0 |
0 |
0 |
|
| 685 |
0 |
| c_headers[i] = sass_make_importer(sass_importer, priority, *header_sv);
|
| 686 |
|
| }
|
| 687 |
|
|
|
| 688 |
0 |
| sass_option_set_c_headers(sass_options, c_headers);
|
| 689 |
|
| }
|
| 690 |
|
|
|
| 691 |
0 |
▶ | if (sass_functions_sv) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sass_functions_sv) {
|
0 |
0 |
0 |
|
| 692 |
|
| int i;
|
| 693 |
|
| AV* sass_functions_av;
|
| 694 |
0 |
▶ | if (!SvROK(*sass_functions_sv) || SvTYPE(SvRV(*sass_functions_sv)) != SVt_PVAV) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(*sass_functions_sv) || SvTYPE(SvRV(*sass_functions_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
| if (!SvROK(*sass_functions_sv) || SvTYPE(SvRV(*sass_functions_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
|
| 695 |
0 |
| return newSVpvf("sass_functions should be an arrayref (SvTYPE=%u)", (unsigned)SvTYPE(SvRV(*sass_functions_sv)));
|
| 696 |
|
| }
|
| 697 |
0 |
| sass_functions_av = (AV*)SvRV(*sass_functions_sv);
|
| 698 |
|
|
|
| 699 |
0 |
| Sass_Function_List c_functions = sass_make_function_list(av_len(sass_functions_av) + 1);
|
| 700 |
|
|
|
| 701 |
0 |
▶ | if (!c_functions) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!c_functions) {
|
0 |
0 |
0 |
|
| 702 |
0 |
| return newSVpv("couldn't alloc memory for c_functions", 0);
|
| 703 |
|
| }
|
| 704 |
0 |
▶ | for (i=0; i<=av_len(sass_functions_av); i++) {
|
Branch: 1 branch
| Branch | True | False | Total |
| for (i=0; i<=av_len(sass_functions_av); i++) {
|
0 |
0 |
0 |
|
| 705 |
0 |
| SV** entry_sv = av_fetch(sass_functions_av, i, false);
|
| 706 |
|
| AV* entry_av;
|
| 707 |
0 |
▶ | if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
| if (!SvROK(*entry_sv) || SvTYPE(SvRV(*entry_sv)) != SVt_PVAV) {
|
0 |
0 |
0 |
|
| 708 |
0 |
| return newSVpvf("each sass_function entry should be an arrayref (SvTYPE=%u)", (unsigned)SvTYPE(SvRV(*entry_sv)));
|
| 709 |
|
| }
|
| 710 |
0 |
| entry_av = (AV*)SvRV(*entry_sv);
|
| 711 |
|
|
|
| 712 |
0 |
| SV** sig_sv = av_fetch(entry_av, 0, false);
|
| 713 |
0 |
| SV** sub_sv = av_fetch(entry_av, 1, false);
|
| 714 |
0 |
▶ | if (!sig_sv) return newSVpv("custom function without prototype", 0);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!sig_sv) return newSVpv("custom function without prototype", 0);
|
0 |
0 |
0 |
|
| 715 |
0 |
▶ | if (!sub_sv) return newSVpv("custom function without callback", 0);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!sub_sv) return newSVpv("custom function without callback", 0);
|
0 |
0 |
0 |
|
| 716 |
0 |
| c_functions[i] = sass_make_function(safe_svpv(*sig_sv, ""), call_sass_function, *sub_sv);
|
| 717 |
|
| }
|
| 718 |
|
|
|
| 719 |
0 |
| sass_option_set_c_functions(sass_options, c_functions);
|
| 720 |
|
| }
|
| 721 |
|
|
|
| 722 |
0 |
| return &PL_sv_undef;
|
| 723 |
|
|
|
| 724 |
|
| }
|
| 725 |
|
|
|
| 726 |
0 |
| void finalize_sass_context(struct Sass_Context* ctx, HV* RETVAL, SV* err)
|
| 727 |
|
| {
|
| 728 |
|
|
|
| 729 |
0 |
| const int error_status = sass_context_get_error_status(ctx);
|
| 730 |
0 |
| const char* error_json = sass_context_get_error_json(ctx);
|
| 731 |
0 |
| const char* error_file = sass_context_get_error_file(ctx);
|
| 732 |
0 |
| size_t error_line = sass_context_get_error_line(ctx);
|
| 733 |
0 |
| size_t error_column = sass_context_get_error_column(ctx);
|
| 734 |
0 |
| const char* error_text = sass_context_get_error_text(ctx);
|
| 735 |
0 |
| const char* error_message = sass_context_get_error_message(ctx);
|
| 736 |
0 |
| const char* error_src = 0; // sass_context_get_error_src(ctx);
|
| 737 |
0 |
| const char* output_string = sass_context_get_output_string(ctx);
|
| 738 |
0 |
| const char* source_map_string = sass_context_get_source_map_string(ctx);
|
| 739 |
0 |
| char** included_files = sass_context_get_included_files(ctx);
|
| 740 |
|
|
|
| 741 |
0 |
| AV* sv_included_files = newAV();
|
| 742 |
0 |
| char** it = included_files;
|
| 743 |
0 |
▶ | while (it && (*it) != 0) {
|
Branch: 2 branches
| Branch | True | False | Total |
| while (it && (*it) != 0) {
|
0 |
0 |
0 |
| while (it && (*it) != 0) {
|
0 |
0 |
0 |
|
| 744 |
0 |
| av_push(sv_included_files, newSVpv(*it, 0));
|
| 745 |
0 |
| ++it;
|
| 746 |
|
| }
|
| 747 |
|
|
|
| 748 |
0 |
▶ | SV* sv_error_status = newSViv(error_status || SvOK(err));
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_status = newSViv(error_status || SvOK(err));
|
0 |
0 |
0 |
| SV* sv_error_status = newSViv(error_status || SvOK(err));
|
0 |
0 |
0 |
|
| 749 |
0 |
▶ | SV* sv_output_string = output_string ? newSVpv(output_string, 0) : newSV(0);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV* sv_output_string = output_string ? newSVpv(output_string, 0) : newSV(0);
|
0 |
0 |
0 |
|
| 750 |
0 |
▶ | SV* sv_source_map_string = source_map_string ? newSVpv(source_map_string, 0) : newSV(0);
|
Branch: 1 branch
| Branch | True | False | Total |
| SV* sv_source_map_string = source_map_string ? newSVpv(source_map_string, 0) : newSV(0);
|
0 |
0 |
0 |
|
| 751 |
0 |
▶ | SV* sv_error_line = SvOK(err) ? err : error_line ? newSViv(error_line) : newSViv(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_line = SvOK(err) ? err : error_line ? newSViv(error_line) : newSViv(0);
|
0 |
0 |
0 |
| SV* sv_error_line = SvOK(err) ? err : error_line ? newSViv(error_line) : newSViv(0);
|
0 |
0 |
0 |
|
| 752 |
0 |
▶ | SV* sv_error_column = SvOK(err) ? err : error_column ? newSViv(error_column) : newSViv(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_column = SvOK(err) ? err : error_column ? newSViv(error_column) : newSViv(0);
|
0 |
0 |
0 |
| SV* sv_error_column = SvOK(err) ? err : error_column ? newSViv(error_column) : newSViv(0);
|
0 |
0 |
0 |
|
| 753 |
0 |
▶ | SV* sv_error_src = SvOK(err) ? err : error_src ? newSVpv(error_src, 0) : newSViv(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_src = SvOK(err) ? err : error_src ? newSVpv(error_src, 0) : newSViv(0);
|
0 |
0 |
0 |
| SV* sv_error_src = SvOK(err) ? err : error_src ? newSVpv(error_src, 0) : newSViv(0);
|
0 |
0 |
0 |
|
| 754 |
0 |
▶ | SV* sv_error_text = SvOK(err) ? err : error_text ? newSVpv(error_text, 0) : newSV(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_text = SvOK(err) ? err : error_text ? newSVpv(error_text, 0) : newSV(0);
|
0 |
0 |
0 |
| SV* sv_error_text = SvOK(err) ? err : error_text ? newSVpv(error_text, 0) : newSV(0);
|
0 |
0 |
0 |
|
| 755 |
0 |
▶ | SV* sv_error_json = SvOK(err) ? err : error_json ? newSVpv(error_json, 0) : newSV(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_json = SvOK(err) ? err : error_json ? newSVpv(error_json, 0) : newSV(0);
|
0 |
0 |
0 |
| SV* sv_error_json = SvOK(err) ? err : error_json ? newSVpv(error_json, 0) : newSV(0);
|
0 |
0 |
0 |
|
| 756 |
0 |
▶ | SV* sv_error_file = SvOK(err) ? err : error_file ? newSVpv(error_file, 0) : newSV(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_file = SvOK(err) ? err : error_file ? newSVpv(error_file, 0) : newSV(0);
|
0 |
0 |
0 |
| SV* sv_error_file = SvOK(err) ? err : error_file ? newSVpv(error_file, 0) : newSV(0);
|
0 |
0 |
0 |
|
| 757 |
0 |
▶ | SV* sv_error_message = SvOK(err) ? err : error_message ? newSVpv(error_message, 0) : newSV(0);
|
Branch: 2 branches
| Branch | True | False | Total |
| SV* sv_error_message = SvOK(err) ? err : error_message ? newSVpv(error_message, 0) : newSV(0);
|
0 |
0 |
0 |
| SV* sv_error_message = SvOK(err) ? err : error_message ? newSVpv(error_message, 0) : newSV(0);
|
0 |
0 |
0 |
|
| 758 |
|
|
|
| 759 |
0 |
| SvUTF8_on(sv_output_string);
|
| 760 |
0 |
| SvUTF8_on(sv_source_map_string);
|
| 761 |
|
|
|
| 762 |
0 |
| SvUTF8_on(sv_error_src);
|
| 763 |
0 |
| SvUTF8_on(sv_error_text);
|
| 764 |
0 |
| SvUTF8_on(sv_error_json);
|
| 765 |
0 |
| SvUTF8_on(sv_error_file);
|
| 766 |
0 |
| SvUTF8_on(sv_error_message);
|
| 767 |
|
|
|
| 768 |
0 |
| (void)hv_stores(RETVAL, "error_status", sv_error_status);
|
| 769 |
0 |
| (void)hv_stores(RETVAL, "output_string", sv_output_string);
|
| 770 |
0 |
| (void)hv_stores(RETVAL, "source_map_string", sv_source_map_string);
|
| 771 |
0 |
| (void)hv_stores(RETVAL, "error_line", sv_error_line);
|
| 772 |
0 |
| (void)hv_stores(RETVAL, "error_column", sv_error_column);
|
| 773 |
0 |
| (void)hv_stores(RETVAL, "error_message", sv_error_message);
|
| 774 |
0 |
| (void)hv_stores(RETVAL, "error_src", sv_error_src);
|
| 775 |
0 |
| (void)hv_stores(RETVAL, "error_text", sv_error_text);
|
| 776 |
0 |
| (void)hv_stores(RETVAL, "error_json", sv_error_json);
|
| 777 |
0 |
| (void)hv_stores(RETVAL, "error_file", sv_error_file);
|
| 778 |
0 |
| (void)hv_stores(RETVAL, "included_files", newRV_noinc((SV*) sv_included_files));
|
| 779 |
|
|
|
| 780 |
0 |
| }
|
| 781 |
|
|
|
| 782 |
|
| MODULE = CSS::Sass PACKAGE = CSS::Sass
|
| 783 |
|
|
|
| 784 |
|
| BOOT:
|
| 785 |
|
| {
|
| 786 |
0 |
| HV* stash = gv_stashpv("CSS::Sass", 0);
|
| 787 |
|
|
|
| 788 |
0 |
| Constant(SASS_STYLE_NESTED);
|
| 789 |
0 |
| Constant(SASS_STYLE_EXPANDED);
|
| 790 |
0 |
| Constant(SASS_STYLE_COMPACT);
|
| 791 |
0 |
| Constant(SASS_STYLE_COMPRESSED);
|
| 792 |
|
|
|
| 793 |
0 |
| Constant(SASS_BOOLEAN);
|
| 794 |
0 |
| Constant(SASS_NUMBER);
|
| 795 |
0 |
| Constant(SASS_COLOR);
|
| 796 |
0 |
| Constant(SASS_STRING);
|
| 797 |
0 |
| Constant(SASS_LIST);
|
| 798 |
0 |
| Constant(SASS_MAP);
|
| 799 |
0 |
| Constant(SASS_NULL);
|
| 800 |
0 |
| Constant(SASS_ERROR);
|
| 801 |
|
|
|
| 802 |
|
| // sass list types
|
| 803 |
0 |
| Constant(SASS_COMMA);
|
| 804 |
0 |
| Constant(SASS_SPACE);
|
| 805 |
|
|
|
| 806 |
|
| // sass2scss constants
|
| 807 |
0 |
| Constant(SASS2SCSS_PRETTIFY_0);
|
| 808 |
0 |
| Constant(SASS2SCSS_PRETTIFY_1);
|
| 809 |
0 |
| Constant(SASS2SCSS_PRETTIFY_2);
|
| 810 |
0 |
| Constant(SASS2SCSS_PRETTIFY_3);
|
| 811 |
|
| // more options for sass2scss
|
| 812 |
0 |
| Constant(SASS2SCSS_KEEP_COMMENT);
|
| 813 |
0 |
| Constant(SASS2SCSS_STRIP_COMMENT);
|
| 814 |
0 |
| Constant(SASS2SCSS_CONVERT_COMMENT);
|
| 815 |
|
|
|
| 816 |
|
| // enum Sass_OP
|
| 817 |
0 |
| Constant(AND);
|
| 818 |
0 |
| Constant(OR);
|
| 819 |
0 |
| Constant(EQ);
|
| 820 |
0 |
| Constant(NEQ);
|
| 821 |
0 |
| Constant(GT);
|
| 822 |
0 |
| Constant(GTE);
|
| 823 |
0 |
| Constant(LT);
|
| 824 |
0 |
| Constant(LTE);
|
| 825 |
0 |
| Constant(ADD);
|
| 826 |
0 |
| Constant(SUB);
|
| 827 |
0 |
| Constant(MUL);
|
| 828 |
0 |
| Constant(DIV);
|
| 829 |
0 |
| Constant(MOD);
|
| 830 |
|
| }
|
| 831 |
|
|
|
| 832 |
|
|
|
| 833 |
|
| HV*
|
| 834 |
|
| compile_sass(input_string, options)
|
| 835 |
|
| char* input_string
|
| 836 |
|
| HV* options
|
| 837 |
|
| CODE:
|
| 838 |
0 |
| RETVAL = newHV();
|
| 839 |
0 |
| sv_2mortal((SV*)RETVAL);
|
| 840 |
|
| {
|
| 841 |
|
|
|
| 842 |
0 |
| char* src = strdup(input_string);
|
| 843 |
|
| // input_string will be freed by libsass (first "loaded" source)
|
| 844 |
0 |
| struct Sass_Data_Context* data_ctx = sass_make_data_context(src);
|
| 845 |
0 |
| struct Sass_Context* ctx = sass_data_context_get_context(data_ctx);
|
| 846 |
0 |
| struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
|
| 847 |
0 |
| SV* err = init_sass_options(ctx_opt, options);
|
| 848 |
0 |
▶ | if (!SvTRUE(err)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvTRUE(err)) {
|
0 |
0 |
0 |
|
| 849 |
0 |
| struct Sass_Compiler* compiler = sass_make_data_compiler(data_ctx);
|
| 850 |
0 |
| sass_compiler_parse(compiler);
|
| 851 |
0 |
| sass_compiler_execute(compiler);
|
| 852 |
0 |
| sass_delete_compiler(compiler);
|
| 853 |
|
| }
|
| 854 |
|
| // if (!SvTRUE(err)) sass_compile_data_context(data_ctx);
|
| 855 |
0 |
| finalize_sass_context(ctx, RETVAL, err);
|
| 856 |
0 |
| sass_delete_data_context(data_ctx);
|
| 857 |
|
|
|
| 858 |
|
| }
|
| 859 |
|
| OUTPUT:
|
| 860 |
|
| RETVAL
|
| 861 |
|
|
|
| 862 |
|
|
|
| 863 |
|
| HV*
|
| 864 |
|
| compile_sass_file(input_path, options)
|
| 865 |
|
| char* input_path
|
| 866 |
|
| HV* options
|
| 867 |
|
| CODE:
|
| 868 |
0 |
| RETVAL = newHV();
|
| 869 |
0 |
| sv_2mortal((SV*)RETVAL);
|
| 870 |
|
| {
|
| 871 |
|
|
|
| 872 |
0 |
| struct Sass_File_Context* file_ctx = sass_make_file_context(input_path);
|
| 873 |
0 |
| struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
|
| 874 |
0 |
| struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
|
| 875 |
0 |
| SV* err = init_sass_options(ctx_opt, options);
|
| 876 |
0 |
▶ | if (!SvTRUE(err)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvTRUE(err)) {
|
0 |
0 |
0 |
|
| 877 |
0 |
| struct Sass_Compiler* compiler = sass_make_file_compiler(file_ctx);
|
| 878 |
0 |
| sass_compiler_parse(compiler);
|
| 879 |
0 |
| sass_compiler_execute(compiler);
|
| 880 |
0 |
| sass_delete_compiler(compiler);
|
| 881 |
|
| }
|
| 882 |
0 |
| finalize_sass_context(ctx, RETVAL, err);
|
| 883 |
0 |
| sass_delete_file_context(file_ctx);
|
| 884 |
|
|
|
| 885 |
|
| }
|
| 886 |
|
| OUTPUT:
|
| 887 |
|
| RETVAL
|
| 888 |
|
|
|
| 889 |
|
| SV*
|
| 890 |
|
| sass2scss(sass, options = SASS2SCSS_PRETTIFY_1)
|
| 891 |
|
| const char* sass
|
| 892 |
|
| int options
|
| 893 |
|
| CODE:
|
| 894 |
|
| {
|
| 895 |
|
|
|
| 896 |
0 |
| char* css = sass2scss(sass, options);
|
| 897 |
0 |
| RETVAL = newSVpv(css, 0);
|
| 898 |
0 |
| sass_free_memory (css);
|
| 899 |
|
|
|
| 900 |
|
| }
|
| 901 |
|
| OUTPUT:
|
| 902 |
|
| RETVAL
|
| 903 |
|
|
|
| 904 |
|
| SV*
|
| 905 |
|
| quote(str)
|
| 906 |
|
| char* str
|
| 907 |
|
| CODE:
|
| 908 |
|
| {
|
| 909 |
|
|
|
| 910 |
0 |
| char* quoted = sass_string_quote(str, '*');
|
| 911 |
|
|
|
| 912 |
0 |
| RETVAL = newSVpv(quoted, 0);
|
| 913 |
|
|
|
| 914 |
0 |
| sass_free_memory (quoted);
|
| 915 |
|
|
|
| 916 |
|
| }
|
| 917 |
|
| OUTPUT:
|
| 918 |
|
| RETVAL
|
| 919 |
|
|
|
| 920 |
|
| SV*
|
| 921 |
|
| unquote(str)
|
| 922 |
|
| char* str
|
| 923 |
|
| CODE:
|
| 924 |
|
| {
|
| 925 |
|
|
|
| 926 |
0 |
| char* unquoted = sass_string_unquote(str);
|
| 927 |
|
|
|
| 928 |
0 |
| RETVAL = newSVpv(unquoted, 0);
|
| 929 |
|
|
|
| 930 |
0 |
| sass_free_memory (unquoted);
|
| 931 |
|
|
|
| 932 |
|
| }
|
| 933 |
|
| OUTPUT:
|
| 934 |
|
| RETVAL
|
| 935 |
|
|
|
| 936 |
|
| SV*
|
| 937 |
|
| sass_operation(op, a, b)
|
| 938 |
|
| SV* op
|
| 939 |
|
| SV* a
|
| 940 |
|
| SV* b
|
| 941 |
|
| CODE:
|
| 942 |
|
| {
|
| 943 |
|
|
|
| 944 |
0 |
| union Sass_Value* lhs = sv_to_sass_value(a);
|
| 945 |
0 |
| union Sass_Value* rhs = sv_to_sass_value(b);
|
| 946 |
|
|
|
| 947 |
0 |
| union Sass_Value* rv = 0;
|
| 948 |
0 |
| switch ((enum Sass_OP) SvNV(op)) {
|
| 949 |
0 |
| case ADD: rv = sass_value_op(ADD, lhs, rhs); break;
|
| 950 |
0 |
| case MUL: rv = sass_value_op(MUL, lhs, rhs); break;
|
| 951 |
0 |
| case AND: rv = sass_value_op(AND, lhs, rhs); break;
|
| 952 |
0 |
| case OR: rv = sass_value_op(OR, lhs, rhs); break;
|
| 953 |
0 |
| case EQ: rv = sass_value_op(EQ, lhs, rhs); break;
|
| 954 |
0 |
| case NEQ: rv = sass_value_op(NEQ, lhs, rhs); break;
|
| 955 |
0 |
| case GT: rv = sass_value_op(GT, lhs, rhs); break;
|
| 956 |
0 |
| case GTE: rv = sass_value_op(GTE, lhs, rhs); break;
|
| 957 |
0 |
| case LT: rv = sass_value_op(LT, lhs, rhs); break;
|
| 958 |
0 |
| case LTE: rv = sass_value_op(LTE, lhs, rhs); break;
|
| 959 |
0 |
| case SUB: rv = sass_value_op(SUB, lhs, rhs); break;
|
| 960 |
0 |
| case DIV: rv = sass_value_op(DIV, lhs, rhs); break;
|
| 961 |
0 |
| case MOD: rv = sass_value_op(MOD, lhs, rhs); break;
|
| 962 |
0 |
| default: rv = sass_make_error("invalid op"); break;
|
| 963 |
|
| }
|
| 964 |
|
|
|
| 965 |
0 |
▶ | if (rv) RETVAL = sass_value_to_sv(rv);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (rv) RETVAL = sass_value_to_sv(rv);
|
0 |
0 |
0 |
|
| 966 |
0 |
| else RETVAL = new_sv_sass_null();
|
| 967 |
|
|
|
| 968 |
0 |
| sass_delete_value(rhs);
|
| 969 |
0 |
| sass_delete_value(lhs);
|
| 970 |
0 |
| sass_delete_value(rv);
|
| 971 |
|
|
|
| 972 |
|
| }
|
| 973 |
|
| OUTPUT:
|
| 974 |
|
| RETVAL
|
| 975 |
|
|
|
| 976 |
|
| SV*
|
| 977 |
|
| sass_stringify(v)
|
| 978 |
|
| SV* v
|
| 979 |
|
| CODE:
|
| 980 |
|
| {
|
| 981 |
|
|
|
| 982 |
0 |
| union Sass_Value* val = sv_to_sass_value(v);
|
| 983 |
|
| // ToDo: make compressed and precision option configurable
|
| 984 |
0 |
| union Sass_Value* rv = sass_value_stringify(val, false, 5);
|
| 985 |
0 |
| RETVAL = sass_value_to_sv(rv);
|
| 986 |
0 |
| sass_delete_value(val);
|
| 987 |
0 |
| sass_delete_value(rv);
|
| 988 |
|
|
|
| 989 |
|
| }
|
| 990 |
|
| OUTPUT:
|
| 991 |
|
| RETVAL
|
| 992 |
|
|
|
| 993 |
|
| SV*
|
| 994 |
|
| auto_quote(str)
|
| 995 |
|
| char* str
|
| 996 |
|
| CODE:
|
| 997 |
|
| {
|
| 998 |
|
|
|
| 999 |
0 |
▶ | if (sass_string_need_quotes(str)) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (sass_string_need_quotes(str)) {
|
0 |
0 |
0 |
|
| 1000 |
|
|
|
| 1001 |
0 |
| char* string = sass_string_quote(str, '*');
|
| 1002 |
|
|
|
| 1003 |
0 |
| RETVAL = newSVpv(string, 0);
|
| 1004 |
|
|
|
| 1005 |
0 |
| sass_free_memory (string);
|
| 1006 |
|
|
|
| 1007 |
|
| } else {
|
| 1008 |
|
|
|
| 1009 |
0 |
| RETVAL = newSVpv(str, 0);
|
| 1010 |
|
|
|
| 1011 |
|
| }
|
| 1012 |
|
|
|
| 1013 |
|
| }
|
| 1014 |
|
| OUTPUT:
|
| 1015 |
|
| RETVAL
|
| 1016 |
|
|
|
| 1017 |
|
| SV*
|
| 1018 |
|
| need_quotes(str)
|
| 1019 |
|
| char* str
|
| 1020 |
|
| CODE:
|
| 1021 |
|
| {
|
| 1022 |
|
|
|
| 1023 |
0 |
▶ | RETVAL = sass_string_need_quotes(str) ? &PL_sv_yes : &PL_sv_no;
|
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = sass_string_need_quotes(str) ? &PL_sv_yes : &PL_sv_no;
|
0 |
0 |
0 |
|
| 1024 |
|
|
|
| 1025 |
|
| }
|
| 1026 |
|
| OUTPUT:
|
| 1027 |
|
| RETVAL
|
| 1028 |
|
|
|
| 1029 |
|
| SV*
|
| 1030 |
|
| import_sv(sv)
|
| 1031 |
|
| SV* sv
|
| 1032 |
|
| CODE:
|
| 1033 |
|
| {
|
| 1034 |
|
|
|
| 1035 |
0 |
| union Sass_Value* value = sv_to_sass_value(sv);
|
| 1036 |
|
|
|
| 1037 |
0 |
| RETVAL = sass_value_to_sv(value);
|
| 1038 |
|
|
|
| 1039 |
0 |
| sass_delete_value(value);
|
| 1040 |
|
|
|
| 1041 |
|
| }
|
| 1042 |
|
| OUTPUT:
|
| 1043 |
|
| RETVAL
|
| 1044 |
|
|
|
| 1045 |
|
| SV*
|
| 1046 |
|
| libsass_version()
|
| 1047 |
|
| CODE:
|
| 1048 |
|
| {
|
| 1049 |
|
|
|
| 1050 |
0 |
| RETVAL = newSVpv(libsass_version(), 0);
|
| 1051 |
|
|
|
| 1052 |
|
| }
|
| 1053 |
|
| OUTPUT:
|
| 1054 |
|
| RETVAL
|
| 1055 |
|
|
|
| 1056 |
|
| SV*
|
| 1057 |
|
| sass2scss_version()
|
| 1058 |
|
| CODE:
|
| 1059 |
|
| {
|
| 1060 |
|
|
|
| 1061 |
0 |
| RETVAL = newSVpv(sass2scss_version(), 0);
|
| 1062 |
|
|
|
| 1063 |
|
| }
|
| 1064 |
|
| OUTPUT:
|
| 1065 |
|
| RETVAL
|