Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
feat(cwrap): export interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jul 13, 2018
1 parent 3c97516 commit c7bffe6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
16 changes: 12 additions & 4 deletions src/interop/options/wrapSassOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,23 @@ const wrapSassOptions = (cwrap: cwrapSignature) => ({
//Sass_C_Function_List sass_option_get_c_functions (struct Sass_Options* options);
option_get_c_functions: null,
//Sass_C_Import_Callback sass_option_get_importer (struct Sass_Options* options);
option_get_importer: null,
option_get_importer: () => {
throw new Error('not implemented');
},

//size_t sass_option_get_include_path_size(struct Sass_Options* options);
option_get_include_path_size: null,
//const char* sass_option_get_include_path(struct Sass_Options* options, size_t i);
option_get_include_path: null,

//size_t sass_option_get_plugin_path_size(struct Sass_Options* options);
option_get_plugin_path_size: null,
option_get_plugin_path_size: () => {
throw new Error('not implemented');
},
//const char* sass_option_get_plugin_path(struct Sass_Options* options, size_t i);
option_get_plugin_path: null,
option_get_plugin_path: () => {
throw new Error('not implemented');
},

//void sass_option_set_precision (struct Sass_Options* options, int precision);
option_set_precision: cwrap<(sassOptionsPtr: number, precision: number) => void>(`sass_option_set_precision`, null, [
Expand Down Expand Up @@ -136,7 +142,9 @@ const wrapSassOptions = (cwrap: cwrapSignature) => ({
//void sass_option_set_c_functions (struct Sass_Options* options, Sass_C_Function_List c_functions);
option_set_c_functions: null,
//void sass_option_set_importer (struct Sass_Options* options, Sass_C_Import_Callback importer);
option_set_importer: null,
option_set_importer: () => {
throw new Error('not implemented');
},

//void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
option_push_plugin_path: cwrap<(sassOptionsPtr: number, path: number) => void>(`sass_option_push_plugin_path`, null, [
Expand Down
22 changes: 16 additions & 6 deletions src/interop/wrapSassContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ const wrapSassContext = (cwrap: cwrapSignature) => ({
//struct Sass_File_Context* sass_make_file_context (const char* input_path);
make_file_context: cwrap<(inputPath: number) => number>(`sass_make_file_context`, 'number', ['number']),
//struct Sass_Data_Context* sass_make_data_context (char* source_string);
make_data_context: null,
make_data_context: cwrap<(inputPath: number) => number>(`sass_make_data_context`, 'number', ['number']),

//int sass_compile_file_context (struct Sass_File_Context* ctx);
compile_file_context: cwrap<(sassFileContextptr: number) => number>(`sass_compile_file_context`, 'number', [
'number'
]),
//int sass_compile_data_context (struct Sass_Data_Context* ctx);
compile_data_context: null,
compile_data_context: cwrap<(sassFileContextptr: number) => number>(`sass_compile_data_context`, 'number', [
'number'
]),

//struct Sass_Compiler* sass_make_file_compiler (struct Sass_File_Context* file_ctx);
make_file_compiler: null,
Expand All @@ -37,14 +39,16 @@ const wrapSassContext = (cwrap: cwrapSignature) => ({
//void sass_delete_file_context (struct Sass_File_Context* ctx);
delete_file_context: cwrap<(sassFileContextptr: number) => void>(`sass_delete_file_context`, null, ['number']),
//void sass_delete_data_context (struct Sass_Data_Context* ctx);
delete_data_context: null,
delete_data_context: cwrap<(sassFileContextptr: number) => void>(`sass_delete_data_context`, null, ['number']),

//struct Sass_Context* sass_file_context_get_context (struct Sass_File_Context* file_ctx);
file_context_get_context: cwrap<(sassFileCtxPtr: number) => number>(`sass_file_context_get_context`, 'number', [
'number'
]),
//struct Sass_Context* sass_data_context_get_context (struct Sass_Data_Context* data_ctx);
data_context_get_context: null,
data_context_get_context: cwrap<(sassFileCtxPtr: number) => number>(`sass_data_context_get_context`, 'number', [
'number'
]),

//struct Sass_Options* sass_context_get_options (struct Sass_Context* ctx);
context_get_options: null,
Expand All @@ -53,15 +57,21 @@ const wrapSassContext = (cwrap: cwrapSignature) => ({
'number'
]),
//struct Sass_Options* sass_data_context_get_options (struct Sass_Data_Context* data_ctx);
data_context_get_options: null,
data_context_get_options: cwrap<(sassFileCtxPtr: number) => number>(`sass_data_context_get_options`, 'number', [
'number'
]),
//void sass_file_context_set_options (struct Sass_File_Context* file_ctx, struct Sass_Options* opt);
file_context_set_options: cwrap<(sassFileCtxPtr: number, sassOptionsPtr: number) => void>(
`sass_file_context_set_options`,
null,
['number', 'number']
),
//void sass_data_context_set_options (struct Sass_Data_Context* data_ctx, struct Sass_Options* opt);
data_context_set_options: null,
data_context_set_options: cwrap<(sassFileCtxPtr: number, sassOptionsPtr: number) => void>(
`sass_data_context_set_options`,
null,
['number', 'number']
),

//const char* sass_context_get_output_string (struct Sass_Context* ctx);
context_get_output_string: cwrap<(sassContextPtr: number) => number>(`sass_context_get_output_string`, 'number', [
Expand Down

0 comments on commit c7bffe6

Please sign in to comment.