This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
forked from sass/libsass
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sass.h
130 lines (107 loc) · 2.68 KB
/
sass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#define SASS
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SASS_OUTPUT_NESTED 0
#define SASS_OUTPUT_EXPANDED 1
#define SASS_OUTPUT_COMPACT 2
#define SASS_OUTPUT_COMPRESSED 3
#define SASS_OUTPUT_FORMATTED 4
struct Sass_Context {
const char* input_path;
const char* input_string;
char* output_string;
int error_status;
char* error_message;
int output_style;
int source_comments;
int source_maps;
const char* image_path;
const char* include_paths_string;
const char** include_paths_array;
};
struct Sass_Context* make_sass_context ();
void free_sass_context (struct Sass_Context*);
void compile_sass_file (struct Sass_Context*);
void compile_sass_string (struct Sass_Context*);
// type tags for Sass values
enum Sass_Tag {
SASS_BOOLEAN,
SASS_NUMBER,
SASS_COLOR,
SASS_STRING,
SASS_LIST,
SASS_NULL,
SASS_ERROR
};
// tags for denoting Sass list separators
enum Sass_Separator {
SASS_COMMA,
SASS_SPACE
};
// Component structs for the Sass value union type.
// Not meant to be used directly.
struct Sass_Unknown {
enum Sass_Tag tag;
};
struct Sass_Boolean {
enum Sass_Tag tag;
int value;
};
struct Sass_Number {
enum Sass_Tag tag;
double value;
char* unit;
};
struct Sass_Color {
enum Sass_Tag tag;
double r;
double g;
double b;
double a;
};
struct Sass_String {
enum Sass_Tag tag;
char* value;
};
union Sass_Value;
struct Sass_List {
enum Sass_Tag tag;
enum Sass_Separator separator;
size_t length;
union Sass_Value* values;
};
struct Sass_Null {
enum Sass_Tag tag;
};
struct Sass_Error {
enum Sass_Tag tag;
char* message;
};
// represention of Sass values in C
union Sass_Value {
struct Sass_Unknown unknown;
struct Sass_Boolean boolean;
struct Sass_Number number;
struct Sass_Color color;
struct Sass_String string;
struct Sass_List list;
struct Sass_Null null;
struct Sass_Error error;
};
union Sass_Value make_sass_boolean (int val);
union Sass_Value make_sass_number (double val, const char* unit);
union Sass_Value make_sass_color (double r, double g, double b, double a);
union Sass_Value make_sass_string (const char* val);
union Sass_Value make_sass_list (size_t len, enum Sass_Separator sep);
union Sass_Value make_sass_null ();
union Sass_Value make_sass_error (const char* msg);
typedef union Sass_Value(*Sass_C_Function)(union Sass_Value);
struct Sass_C_Function_Descriptor {
const char* signature;
Sass_C_Function function;
};
#ifdef __cplusplus
}
#endif