Sha256: e981af1ad2b272c192b3655cc6e22752d9cf4345eecc9e74371e51181f585fa6

Contents?: true

Size: 1.37 KB

Versions: 54

Compression:

Stored size: 1.37 KB

Contents

## Example operation.c

```C
#include <stdio.h>
#include <string.h>
#include "sass/values.h"

int main( int argc, const char* argv[] )
{

  // create two new sass values to be added
  union Sass_Value* string = sass_make_string("String");
  union Sass_Value* number = sass_make_number(42, "nits");

  // invoke the add operation which returns a new sass value
  union Sass_Value* total = sass_value_op(ADD, string, number);

  // no further use for the two operands
  sass_delete_value(string);
  sass_delete_value(number);

  // this works since libsass will always return a
  // string for add operations with a string as the
  // left hand side. But you should never rely on it!
  puts(sass_string_get_value(total));

  // invoke stringification (uncompressed with precision of 5)
  union Sass_Value* result = sass_value_stringify(total, false, 5);

  // no further use for the sum
  sass_delete_value(total);

  // print the result - you may want to make
  // sure result is indeed a string, altough
  // stringify guarantees to return a string
  // if (sass_value_is_string(result)) {}
  // really depends on your level of paranoia
  puts(sass_string_get_value(result));

  // finally free result
  sass_delete_value(result);

  // exit status
  return 0;

}
```

## Compile operation.c

```bash
gcc -c operation.c -o operation.o
gcc -o operation operation.o -lsass
./operation # => String42nits
```

Version data entries

54 entries across 52 versions & 16 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@rails/webpacker/node_modules/node-sass/src/libsass/docs/api-value-example.md
optimacms-0.1.61 spec/dummy/node_modules/node-sass/src/libsass/docs/api-value-example.md
disco_app-0.18.0 test/dummy/node_modules/node-sass/src/libsass/docs/api-value-example.md
disco_app-0.18.2 test/dummy/node_modules/node-sass/src/libsass/docs/api-value-example.md
tang-0.2.1 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-value-example.md
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/node-sass/src/libsass/docs/api-value-example.md
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/node-sass/src/libsass/docs/api-value-example.md
ruby2js-4.0.4 lib/tasks/testrails/node_modules/node-sass/src/libsass/docs/api-value-example.md
ruby2js-4.0.3 lib/tasks/testrails/node_modules/node-sass/src/libsass/docs/api-value-example.md
tang-0.2.0 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-value-example.md
tang-0.1.0 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-value-example.md
tang-0.0.9 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-value-example.md
enju_library-0.3.8 spec/dummy/node_modules/node-sass/src/libsass/docs/api-value-example.md
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/sassc-2.0.0/ext/libsass/docs/api-value-example.md
ilog-0.4.1 node_modules/node-sass/src/libsass/docs/api-value-example.md
ilog-0.4.0 node_modules/node-sass/src/libsass/docs/api-value-example.md
ilog-0.3.3 node_modules/node-sass/src/libsass/docs/api-value-example.md
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/docs/api-value-example.md
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/docs/api-value-example.md
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/docs/api-value-example.md