lipgloss 0.1.0-x86-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,242 @@
1
+ #include "extension.h"
2
+
3
+ static void table_free(void *pointer) {
4
+ lipgloss_table_t *table = (lipgloss_table_t *) pointer;
5
+
6
+ if (table->handle != 0) {
7
+ lipgloss_table_free(table->handle);
8
+ }
9
+
10
+ xfree(table);
11
+ }
12
+
13
+ static size_t table_memsize(const void *pointer) {
14
+ return sizeof(lipgloss_table_t);
15
+ }
16
+
17
+ const rb_data_type_t table_type = {
18
+ .wrap_struct_name = "Lipgloss::Table",
19
+ .function = {
20
+ .dmark = NULL,
21
+ .dfree = table_free,
22
+ .dsize = table_memsize,
23
+ },
24
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY
25
+ };
26
+
27
+ static VALUE table_alloc(VALUE klass) {
28
+ lipgloss_table_t *table = ALLOC(lipgloss_table_t);
29
+ table->handle = lipgloss_table_new();
30
+ return TypedData_Wrap_Struct(klass, &table_type, table);
31
+ }
32
+
33
+ VALUE table_wrap(VALUE klass, unsigned long long handle) {
34
+ lipgloss_table_t *table = ALLOC(lipgloss_table_t);
35
+ table->handle = handle;
36
+ return TypedData_Wrap_Struct(klass, &table_type, table);
37
+ }
38
+
39
+ static VALUE table_initialize(VALUE self) {
40
+ return self;
41
+ }
42
+
43
+ static VALUE table_headers(VALUE self, VALUE headers) {
44
+ GET_TABLE(self, table);
45
+ Check_Type(headers, T_ARRAY);
46
+
47
+ VALUE json_str = rb_funcall(headers, rb_intern("to_json"), 0);
48
+ unsigned long long new_handle = lipgloss_table_headers(table->handle, StringValueCStr(json_str));
49
+ return table_wrap(rb_class_of(self), new_handle);
50
+ }
51
+
52
+ static VALUE table_row(VALUE self, VALUE row) {
53
+ GET_TABLE(self, table);
54
+ Check_Type(row, T_ARRAY);
55
+
56
+ VALUE json_str = rb_funcall(row, rb_intern("to_json"), 0);
57
+ unsigned long long new_handle = lipgloss_table_row(table->handle, StringValueCStr(json_str));
58
+ return table_wrap(rb_class_of(self), new_handle);
59
+ }
60
+
61
+ static VALUE table_rows(VALUE self, VALUE rows) {
62
+ GET_TABLE(self, table);
63
+ Check_Type(rows, T_ARRAY);
64
+
65
+ VALUE json_str = rb_funcall(rows, rb_intern("to_json"), 0);
66
+ unsigned long long new_handle = lipgloss_table_rows(table->handle, StringValueCStr(json_str));
67
+
68
+ return table_wrap(rb_class_of(self), new_handle);
69
+ }
70
+
71
+ static int symbol_to_table_border_type(VALUE symbol) {
72
+ if (symbol == ID2SYM(rb_intern("normal"))) return BORDER_NORMAL;
73
+ if (symbol == ID2SYM(rb_intern("rounded"))) return BORDER_ROUNDED;
74
+ if (symbol == ID2SYM(rb_intern("thick"))) return BORDER_THICK;
75
+ if (symbol == ID2SYM(rb_intern("double"))) return BORDER_DOUBLE;
76
+ if (symbol == ID2SYM(rb_intern("hidden"))) return BORDER_HIDDEN;
77
+ if (symbol == ID2SYM(rb_intern("block"))) return BORDER_BLOCK;
78
+ if (symbol == ID2SYM(rb_intern("outer_half_block"))) return BORDER_OUTER_HALF_BLOCK;
79
+ if (symbol == ID2SYM(rb_intern("inner_half_block"))) return BORDER_INNER_HALF_BLOCK;
80
+ if (symbol == ID2SYM(rb_intern("ascii"))) return BORDER_ASCII;
81
+ if (symbol == ID2SYM(rb_intern("markdown"))) return BORDER_MARKDOWN;
82
+
83
+ return BORDER_NORMAL;
84
+ }
85
+
86
+ static VALUE table_border(VALUE self, VALUE border_sym) {
87
+ GET_TABLE(self, table);
88
+ int border_type = symbol_to_table_border_type(border_sym);
89
+ unsigned long long new_handle = lipgloss_table_border(table->handle, border_type);
90
+
91
+ return table_wrap(rb_class_of(self), new_handle);
92
+ }
93
+
94
+ static VALUE table_border_style(VALUE self, VALUE style_object) {
95
+ GET_TABLE(self, table);
96
+ lipgloss_style_t *style;
97
+
98
+ TypedData_Get_Struct(style_object, lipgloss_style_t, &style_type, style);
99
+ unsigned long long new_handle = lipgloss_table_border_style(table->handle, style->handle);
100
+
101
+ return table_wrap(rb_class_of(self), new_handle);
102
+ }
103
+
104
+ static VALUE table_border_top(VALUE self, VALUE value) {
105
+ GET_TABLE(self, table);
106
+ unsigned long long new_handle = lipgloss_table_border_top(table->handle, RTEST(value) ? 1 : 0);
107
+ return table_wrap(rb_class_of(self), new_handle);
108
+ }
109
+
110
+ static VALUE table_border_bottom(VALUE self, VALUE value) {
111
+ GET_TABLE(self, table);
112
+ unsigned long long new_handle = lipgloss_table_border_bottom(table->handle, RTEST(value) ? 1 : 0);
113
+ return table_wrap(rb_class_of(self), new_handle);
114
+ }
115
+
116
+ static VALUE table_border_left(VALUE self, VALUE value) {
117
+ GET_TABLE(self, table);
118
+ unsigned long long new_handle = lipgloss_table_border_left(table->handle, RTEST(value) ? 1 : 0);
119
+ return table_wrap(rb_class_of(self), new_handle);
120
+ }
121
+
122
+ static VALUE table_border_right(VALUE self, VALUE value) {
123
+ GET_TABLE(self, table);
124
+ unsigned long long new_handle = lipgloss_table_border_right(table->handle, RTEST(value) ? 1 : 0);
125
+ return table_wrap(rb_class_of(self), new_handle);
126
+ }
127
+
128
+ static VALUE table_border_header(VALUE self, VALUE value) {
129
+ GET_TABLE(self, table);
130
+ unsigned long long new_handle = lipgloss_table_border_header(table->handle, RTEST(value) ? 1 : 0);
131
+ return table_wrap(rb_class_of(self), new_handle);
132
+ }
133
+
134
+ static VALUE table_border_column(VALUE self, VALUE value) {
135
+ GET_TABLE(self, table);
136
+ unsigned long long new_handle = lipgloss_table_border_column(table->handle, RTEST(value) ? 1 : 0);
137
+ return table_wrap(rb_class_of(self), new_handle);
138
+ }
139
+
140
+ static VALUE table_border_row_m(VALUE self, VALUE value) {
141
+ GET_TABLE(self, table);
142
+ unsigned long long new_handle = lipgloss_table_border_row(table->handle, RTEST(value) ? 1 : 0);
143
+ return table_wrap(rb_class_of(self), new_handle);
144
+ }
145
+
146
+ static VALUE table_width(VALUE self, VALUE width) {
147
+ GET_TABLE(self, table);
148
+ unsigned long long new_handle = lipgloss_table_width(table->handle, NUM2INT(width));
149
+ return table_wrap(rb_class_of(self), new_handle);
150
+ }
151
+
152
+ static VALUE table_height(VALUE self, VALUE height) {
153
+ GET_TABLE(self, table);
154
+ unsigned long long new_handle = lipgloss_table_height(table->handle, NUM2INT(height));
155
+ return table_wrap(rb_class_of(self), new_handle);
156
+ }
157
+
158
+ static VALUE table_offset(VALUE self, VALUE offset) {
159
+ GET_TABLE(self, table);
160
+ unsigned long long new_handle = lipgloss_table_offset(table->handle, NUM2INT(offset));
161
+ return table_wrap(rb_class_of(self), new_handle);
162
+ }
163
+
164
+ static VALUE table_wrap_m(VALUE self, VALUE value) {
165
+ GET_TABLE(self, table);
166
+ unsigned long long new_handle = lipgloss_table_wrap(table->handle, RTEST(value) ? 1 : 0);
167
+ return table_wrap(rb_class_of(self), new_handle);
168
+ }
169
+
170
+ static VALUE table_clear_rows(VALUE self) {
171
+ GET_TABLE(self, table);
172
+ unsigned long long new_handle = lipgloss_table_clear_rows(table->handle);
173
+ return table_wrap(rb_class_of(self), new_handle);
174
+ }
175
+
176
+ static VALUE table_render(VALUE self) {
177
+ GET_TABLE(self, table);
178
+ char *result = lipgloss_table_render(table->handle);
179
+ VALUE rb_result = rb_utf8_str_new_cstr(result);
180
+
181
+ lipgloss_free(result);
182
+
183
+ return rb_result;
184
+ }
185
+
186
+ static VALUE table_to_s(VALUE self) {
187
+ return table_render(self);
188
+ }
189
+
190
+ // Apply a pre-computed style map: { "row,col" => style_handle, ... }
191
+ static VALUE table_style_func_map(VALUE self, VALUE style_map) {
192
+ GET_TABLE(self, table);
193
+ Check_Type(style_map, T_HASH);
194
+
195
+ VALUE json_hash = rb_hash_new();
196
+ VALUE keys = rb_funcall(style_map, rb_intern("keys"), 0);
197
+
198
+ long length = RARRAY_LEN(keys);
199
+
200
+ for (long index = 0; index < length; index++) {
201
+ VALUE key = rb_ary_entry(keys, index);
202
+ VALUE style_object = rb_hash_aref(style_map, key);
203
+
204
+ lipgloss_style_t *style;
205
+ TypedData_Get_Struct(style_object, lipgloss_style_t, &style_type, style);
206
+
207
+ rb_hash_aset(json_hash, key, ULL2NUM(style->handle));
208
+ }
209
+
210
+ VALUE json_str = rb_funcall(json_hash, rb_intern("to_json"), 0);
211
+ unsigned long long new_handle = lipgloss_table_style_func(table->handle, StringValueCStr(json_str));
212
+
213
+ return table_wrap(rb_class_of(self), new_handle);
214
+ }
215
+
216
+ void Init_lipgloss_table(void) {
217
+ cTable = rb_define_class_under(mLipgloss, "Table", rb_cObject);
218
+
219
+ rb_define_alloc_func(cTable, table_alloc);
220
+
221
+ rb_define_method(cTable, "initialize", table_initialize, 0);
222
+ rb_define_method(cTable, "headers", table_headers, 1);
223
+ rb_define_method(cTable, "row", table_row, 1);
224
+ rb_define_method(cTable, "rows", table_rows, 1);
225
+ rb_define_method(cTable, "border", table_border, 1);
226
+ rb_define_method(cTable, "border_style", table_border_style, 1);
227
+ rb_define_method(cTable, "border_top", table_border_top, 1);
228
+ rb_define_method(cTable, "border_bottom", table_border_bottom, 1);
229
+ rb_define_method(cTable, "border_left", table_border_left, 1);
230
+ rb_define_method(cTable, "border_right", table_border_right, 1);
231
+ rb_define_method(cTable, "border_header", table_border_header, 1);
232
+ rb_define_method(cTable, "border_column", table_border_column, 1);
233
+ rb_define_method(cTable, "border_row", table_border_row_m, 1);
234
+ rb_define_method(cTable, "width", table_width, 1);
235
+ rb_define_method(cTable, "height", table_height, 1);
236
+ rb_define_method(cTable, "offset", table_offset, 1);
237
+ rb_define_method(cTable, "wrap", table_wrap_m, 1);
238
+ rb_define_method(cTable, "clear_rows", table_clear_rows, 0);
239
+ rb_define_method(cTable, "_style_func_map", table_style_func_map, 1);
240
+ rb_define_method(cTable, "render", table_render, 0);
241
+ rb_define_method(cTable, "to_s", table_to_s, 0);
242
+ }
@@ -0,0 +1,192 @@
1
+ #include "extension.h"
2
+
3
+ static void tree_free(void *pointer) {
4
+ lipgloss_tree_t *tree = (lipgloss_tree_t *) pointer;
5
+
6
+ if (tree->handle != 0) {
7
+ lipgloss_tree_free(tree->handle);
8
+ }
9
+
10
+ xfree(tree);
11
+ }
12
+
13
+ static size_t tree_memsize(const void *pointer) {
14
+ return sizeof(lipgloss_tree_t);
15
+ }
16
+
17
+ const rb_data_type_t tree_type = {
18
+ .wrap_struct_name = "Lipgloss::Tree",
19
+ .function = {
20
+ .dmark = NULL,
21
+ .dfree = tree_free,
22
+ .dsize = tree_memsize,
23
+ },
24
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY
25
+ };
26
+
27
+ static VALUE tree_alloc(VALUE klass) {
28
+ lipgloss_tree_t *tree = ALLOC(lipgloss_tree_t);
29
+ tree->handle = lipgloss_tree_new();
30
+
31
+ return TypedData_Wrap_Struct(klass, &tree_type, tree);
32
+ }
33
+
34
+ VALUE tree_wrap_handle(VALUE klass, unsigned long long handle) {
35
+ lipgloss_tree_t *tree = ALLOC(lipgloss_tree_t);
36
+ tree->handle = handle;
37
+
38
+ return TypedData_Wrap_Struct(klass, &tree_type, tree);
39
+ }
40
+
41
+ static VALUE tree_initialize(int argc, VALUE *argv, VALUE self) {
42
+ if (argc == 1) {
43
+ GET_TREE(self, tree);
44
+ VALUE root = argv[0];
45
+ Check_Type(root, T_STRING);
46
+ tree->handle = lipgloss_tree_set_root(tree->handle, StringValueCStr(root));
47
+ }
48
+
49
+ return self;
50
+ }
51
+
52
+ static VALUE tree_root_m(VALUE klass, VALUE root) {
53
+ Check_Type(root, T_STRING);
54
+ unsigned long long handle = lipgloss_tree_root(StringValueCStr(root));
55
+
56
+ return tree_wrap_handle(klass, handle);
57
+ }
58
+
59
+ static VALUE tree_set_root(VALUE self, VALUE root) {
60
+ GET_TREE(self, tree);
61
+ Check_Type(root, T_STRING);
62
+ unsigned long long new_handle = lipgloss_tree_set_root(tree->handle, StringValueCStr(root));
63
+
64
+ return tree_wrap_handle(rb_class_of(self), new_handle);
65
+ }
66
+
67
+ static VALUE tree_child(int argc, VALUE *argv, VALUE self) {
68
+ GET_TREE(self, tree);
69
+
70
+ if (argc == 0) {
71
+ rb_raise(rb_eArgError, "wrong number of arguments (given 0, expected 1+)");
72
+ }
73
+
74
+ VALUE result = self;
75
+ for (int index = 0; index < argc; index++) {
76
+ lipgloss_tree_t *current;
77
+ TypedData_Get_Struct(result, lipgloss_tree_t, &tree_type, current);
78
+
79
+ VALUE child = argv[index];
80
+
81
+ if (rb_obj_is_kind_of(child, cTree)) {
82
+ lipgloss_tree_t *subtree;
83
+ TypedData_Get_Struct(child, lipgloss_tree_t, &tree_type, subtree);
84
+ unsigned long long new_handle = lipgloss_tree_child_tree(current->handle, subtree->handle);
85
+ result = tree_wrap_handle(rb_class_of(self), new_handle);
86
+ } else {
87
+ Check_Type(child, T_STRING);
88
+ unsigned long long new_handle = lipgloss_tree_child(current->handle, StringValueCStr(child));
89
+ result = tree_wrap_handle(rb_class_of(self), new_handle);
90
+ }
91
+ }
92
+
93
+ return result;
94
+ }
95
+
96
+ static VALUE tree_children(VALUE self, VALUE children) {
97
+ GET_TREE(self, tree);
98
+ Check_Type(children, T_ARRAY);
99
+
100
+ VALUE json_str = rb_funcall(children, rb_intern("to_json"), 0);
101
+ unsigned long long new_handle = lipgloss_tree_children(tree->handle, StringValueCStr(json_str));
102
+
103
+ return tree_wrap_handle(rb_class_of(self), new_handle);
104
+ }
105
+
106
+ #define TREE_ENUMERATOR_DEFAULT 0
107
+ #define TREE_ENUMERATOR_ROUNDED 1
108
+
109
+ static int symbol_to_tree_enumerator(VALUE symbol) {
110
+ if (symbol == ID2SYM(rb_intern("default"))) return TREE_ENUMERATOR_DEFAULT;
111
+ if (symbol == ID2SYM(rb_intern("rounded"))) return TREE_ENUMERATOR_ROUNDED;
112
+
113
+ return TREE_ENUMERATOR_DEFAULT;
114
+ }
115
+
116
+ static VALUE tree_enumerator(VALUE self, VALUE enum_symbol) {
117
+ GET_TREE(self, tree);
118
+ int enum_type = symbol_to_tree_enumerator(enum_symbol);
119
+ unsigned long long new_handle = lipgloss_tree_enumerator(tree->handle, enum_type);
120
+
121
+ return tree_wrap_handle(rb_class_of(self), new_handle);
122
+ }
123
+
124
+ static VALUE tree_enumerator_style(VALUE self, VALUE style_object) {
125
+ GET_TREE(self, tree);
126
+ lipgloss_style_t *style;
127
+
128
+ TypedData_Get_Struct(style_object, lipgloss_style_t, &style_type, style);
129
+ unsigned long long new_handle = lipgloss_tree_enumerator_style(tree->handle, style->handle);
130
+
131
+ return tree_wrap_handle(rb_class_of(self), new_handle);
132
+ }
133
+
134
+ static VALUE tree_item_style(VALUE self, VALUE style_object) {
135
+ GET_TREE(self, tree);
136
+ lipgloss_style_t *style;
137
+
138
+ TypedData_Get_Struct(style_object, lipgloss_style_t, &style_type, style);
139
+ unsigned long long new_handle = lipgloss_tree_item_style(tree->handle, style->handle);
140
+
141
+ return tree_wrap_handle(rb_class_of(self), new_handle);
142
+ }
143
+
144
+ static VALUE tree_root_style(VALUE self, VALUE style_object) {
145
+ GET_TREE(self, tree);
146
+ lipgloss_style_t *style;
147
+
148
+ TypedData_Get_Struct(style_object, lipgloss_style_t, &style_type, style);
149
+ unsigned long long new_handle = lipgloss_tree_root_style(tree->handle, style->handle);
150
+
151
+ return tree_wrap_handle(rb_class_of(self), new_handle);
152
+ }
153
+
154
+ static VALUE tree_offset(VALUE self, VALUE start, VALUE end) {
155
+ GET_TREE(self, tree);
156
+ unsigned long long new_handle = lipgloss_tree_offset(tree->handle, NUM2INT(start), NUM2INT(end));
157
+
158
+ return tree_wrap_handle(rb_class_of(self), new_handle);
159
+ }
160
+
161
+ static VALUE tree_render(VALUE self) {
162
+ GET_TREE(self, tree);
163
+ char *result = lipgloss_tree_render(tree->handle);
164
+ VALUE rb_result = rb_utf8_str_new_cstr(result);
165
+
166
+ lipgloss_free(result);
167
+
168
+ return rb_result;
169
+ }
170
+
171
+ static VALUE tree_to_s(VALUE self) {
172
+ return tree_render(self);
173
+ }
174
+
175
+ void Init_lipgloss_tree(void) {
176
+ cTree = rb_define_class_under(mLipgloss, "Tree", rb_cObject);
177
+
178
+ rb_define_alloc_func(cTree, tree_alloc);
179
+ rb_define_singleton_method(cTree, "root", tree_root_m, 1);
180
+
181
+ rb_define_method(cTree, "initialize", tree_initialize, -1);
182
+ rb_define_method(cTree, "root=", tree_set_root, 1);
183
+ rb_define_method(cTree, "child", tree_child, -1);
184
+ rb_define_method(cTree, "children", tree_children, 1);
185
+ rb_define_method(cTree, "enumerator", tree_enumerator, 1);
186
+ rb_define_method(cTree, "enumerator_style", tree_enumerator_style, 1);
187
+ rb_define_method(cTree, "item_style", tree_item_style, 1);
188
+ rb_define_method(cTree, "root_style", tree_root_style, 1);
189
+ rb_define_method(cTree, "offset", tree_offset, 2);
190
+ rb_define_method(cTree, "render", tree_render, 0);
191
+ rb_define_method(cTree, "to_s", tree_to_s, 0);
192
+ }
Binary file
@@ -0,0 +1,227 @@
1
+ /* Code generated by cmd/cgo; DO NOT EDIT. */
2
+
3
+ /* package github.com/marcoroth/lipgloss-ruby/go */
4
+
5
+
6
+ #line 1 "cgo-builtin-export-prolog"
7
+
8
+ #include <stddef.h>
9
+
10
+ #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
+ #define GO_CGO_EXPORT_PROLOGUE_H
12
+
13
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
14
+ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
+ #endif
16
+
17
+ #endif
18
+
19
+ /* Start of preamble from import "C" comments. */
20
+
21
+
22
+
23
+ #line 3 "lipgloss.go"
24
+
25
+ #include <stdlib.h>
26
+
27
+ #line 1 "cgo-generated-wrapper"
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ /* End of preamble from import "C" comments. */
38
+
39
+
40
+ /* Start of boilerplate cgo prologue. */
41
+ #line 1 "cgo-gcc-export-header-prolog"
42
+
43
+ #ifndef GO_CGO_PROLOGUE_H
44
+ #define GO_CGO_PROLOGUE_H
45
+
46
+ typedef signed char GoInt8;
47
+ typedef unsigned char GoUint8;
48
+ typedef short GoInt16;
49
+ typedef unsigned short GoUint16;
50
+ typedef int GoInt32;
51
+ typedef unsigned int GoUint32;
52
+ typedef long long GoInt64;
53
+ typedef unsigned long long GoUint64;
54
+ typedef GoInt32 GoInt;
55
+ typedef GoUint32 GoUint;
56
+ typedef size_t GoUintptr;
57
+ typedef float GoFloat32;
58
+ typedef double GoFloat64;
59
+ #ifdef _MSC_VER
60
+ #include <complex.h>
61
+ typedef _Fcomplex GoComplex64;
62
+ typedef _Dcomplex GoComplex128;
63
+ #else
64
+ typedef float _Complex GoComplex64;
65
+ typedef double _Complex GoComplex128;
66
+ #endif
67
+
68
+ /*
69
+ static assertion to make sure the file is being used on architecture
70
+ at least with matching size of GoInt.
71
+ */
72
+ typedef char _check_for_32_bit_pointer_matching_GoInt[sizeof(void*)==32/8 ? 1:-1];
73
+
74
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
75
+ typedef _GoString_ GoString;
76
+ #endif
77
+ typedef void *GoMap;
78
+ typedef void *GoChan;
79
+ typedef struct { void *t; void *v; } GoInterface;
80
+ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
81
+
82
+ #endif
83
+
84
+ /* End of boilerplate cgo prologue. */
85
+
86
+ #ifdef __cplusplus
87
+ extern "C" {
88
+ #endif
89
+
90
+ extern char* lipgloss_join_horizontal(double position, char* stringsJSON);
91
+ extern char* lipgloss_join_vertical(double position, char* stringsJSON);
92
+ extern int lipgloss_width(char* text);
93
+ extern int lipgloss_height(char* text);
94
+ extern char* lipgloss_place(int width, int height, double horizontalPosition, double verticalPosition, char* text);
95
+ extern char* lipgloss_place_horizontal(int width, double position, char* text);
96
+ extern char* lipgloss_place_vertical(int height, double position, char* text);
97
+ extern int lipgloss_has_dark_background();
98
+ extern void lipgloss_free(char* pointer);
99
+ extern char* lipgloss_upstream_version();
100
+ extern long long unsigned int lipgloss_list_new();
101
+ extern void lipgloss_list_free(long long unsigned int id);
102
+ extern long long unsigned int lipgloss_list_item(long long unsigned int id, char* item);
103
+ extern long long unsigned int lipgloss_list_item_list(long long unsigned int id, long long unsigned int sublistID);
104
+ extern long long unsigned int lipgloss_list_items(long long unsigned int id, char* itemsJSON);
105
+ extern long long unsigned int lipgloss_list_enumerator(long long unsigned int id, int enumType);
106
+ extern long long unsigned int lipgloss_list_enumerator_style(long long unsigned int id, long long unsigned int styleID);
107
+ extern long long unsigned int lipgloss_list_item_style(long long unsigned int id, long long unsigned int styleID);
108
+ extern char* lipgloss_list_render(long long unsigned int id);
109
+ extern long long unsigned int lipgloss_new_style();
110
+ extern void lipgloss_free_style(long long unsigned int id);
111
+ extern char* lipgloss_style_render(long long unsigned int id, char* text);
112
+ extern long long unsigned int lipgloss_style_bold(long long unsigned int id, int value);
113
+ extern long long unsigned int lipgloss_style_italic(long long unsigned int id, int value);
114
+ extern long long unsigned int lipgloss_style_underline(long long unsigned int id, int value);
115
+ extern long long unsigned int lipgloss_style_strikethrough(long long unsigned int id, int value);
116
+ extern long long unsigned int lipgloss_style_reverse(long long unsigned int id, int value);
117
+ extern long long unsigned int lipgloss_style_blink(long long unsigned int id, int value);
118
+ extern long long unsigned int lipgloss_style_faint(long long unsigned int id, int value);
119
+ extern long long unsigned int lipgloss_style_foreground(long long unsigned int id, char* color);
120
+ extern long long unsigned int lipgloss_style_background(long long unsigned int id, char* color);
121
+ extern long long unsigned int lipgloss_style_foreground_adaptive(long long unsigned int id, char* light, char* dark);
122
+ extern long long unsigned int lipgloss_style_background_adaptive(long long unsigned int id, char* light, char* dark);
123
+ extern long long unsigned int lipgloss_style_foreground_complete(long long unsigned int id, char* trueColor, char* ansi256, char* ansi);
124
+ extern long long unsigned int lipgloss_style_background_complete(long long unsigned int id, char* trueColor, char* ansi256, char* ansi);
125
+ extern long long unsigned int lipgloss_style_foreground_complete_adaptive(long long unsigned int id, char* lightTrue, char* lightAnsi256, char* lightAnsi, char* darkTrue, char* darkAnsi256, char* darkAnsi);
126
+ extern long long unsigned int lipgloss_style_background_complete_adaptive(long long unsigned int id, char* lightTrue, char* lightAnsi256, char* lightAnsi, char* darkTrue, char* darkAnsi256, char* darkAnsi);
127
+ extern long long unsigned int lipgloss_style_width(long long unsigned int id, int width);
128
+ extern long long unsigned int lipgloss_style_height(long long unsigned int id, int height);
129
+ extern long long unsigned int lipgloss_style_max_width(long long unsigned int id, int width);
130
+ extern long long unsigned int lipgloss_style_max_height(long long unsigned int id, int height);
131
+ extern long long unsigned int lipgloss_style_align(long long unsigned int id, double* positions, int count);
132
+ extern long long unsigned int lipgloss_style_align_horizontal(long long unsigned int id, double position);
133
+ extern long long unsigned int lipgloss_style_align_vertical(long long unsigned int id, double position);
134
+ extern long long unsigned int lipgloss_style_inline(long long unsigned int id, int value);
135
+ extern long long unsigned int lipgloss_style_tab_width(long long unsigned int id, int width);
136
+ extern long long unsigned int lipgloss_style_underline_spaces(long long unsigned int id, int value);
137
+ extern long long unsigned int lipgloss_style_strikethrough_spaces(long long unsigned int id, int value);
138
+ extern long long unsigned int lipgloss_style_set_string(long long unsigned int id, char* text);
139
+ extern long long unsigned int lipgloss_style_inherit(long long unsigned int id, long long unsigned int inheritFromID);
140
+ extern char* lipgloss_style_string(long long unsigned int id);
141
+ extern long long unsigned int lipgloss_style_border(long long unsigned int id, int borderType, int* sides, int sidesCount);
142
+ extern long long unsigned int lipgloss_style_border_style(long long unsigned int id, int borderType);
143
+ extern long long unsigned int lipgloss_style_border_custom(long long unsigned int id, char* top, char* bottom, char* left, char* right, char* topLeft, char* topRight, char* bottomLeft, char* bottomRight, char* middleLeft, char* middleRight, char* middle, char* middleTop, char* middleBottom);
144
+ extern long long unsigned int lipgloss_style_border_foreground(long long unsigned int id, char* color);
145
+ extern long long unsigned int lipgloss_style_border_background(long long unsigned int id, char* color);
146
+ extern long long unsigned int lipgloss_style_border_top(long long unsigned int id, int value);
147
+ extern long long unsigned int lipgloss_style_border_right(long long unsigned int id, int value);
148
+ extern long long unsigned int lipgloss_style_border_bottom(long long unsigned int id, int value);
149
+ extern long long unsigned int lipgloss_style_border_left(long long unsigned int id, int value);
150
+ extern long long unsigned int lipgloss_style_border_top_foreground(long long unsigned int id, char* color);
151
+ extern long long unsigned int lipgloss_style_border_right_foreground(long long unsigned int id, char* color);
152
+ extern long long unsigned int lipgloss_style_border_bottom_foreground(long long unsigned int id, char* color);
153
+ extern long long unsigned int lipgloss_style_border_left_foreground(long long unsigned int id, char* color);
154
+ extern long long unsigned int lipgloss_style_border_top_background(long long unsigned int id, char* color);
155
+ extern long long unsigned int lipgloss_style_border_right_background(long long unsigned int id, char* color);
156
+ extern long long unsigned int lipgloss_style_border_bottom_background(long long unsigned int id, char* color);
157
+ extern long long unsigned int lipgloss_style_border_left_background(long long unsigned int id, char* color);
158
+ extern long long unsigned int lipgloss_style_padding(long long unsigned int id, int* values, int count);
159
+ extern long long unsigned int lipgloss_style_padding_top(long long unsigned int id, int value);
160
+ extern long long unsigned int lipgloss_style_padding_right(long long unsigned int id, int value);
161
+ extern long long unsigned int lipgloss_style_padding_bottom(long long unsigned int id, int value);
162
+ extern long long unsigned int lipgloss_style_padding_left(long long unsigned int id, int value);
163
+ extern long long unsigned int lipgloss_style_margin(long long unsigned int id, int* values, int count);
164
+ extern long long unsigned int lipgloss_style_margin_top(long long unsigned int id, int value);
165
+ extern long long unsigned int lipgloss_style_margin_right(long long unsigned int id, int value);
166
+ extern long long unsigned int lipgloss_style_margin_bottom(long long unsigned int id, int value);
167
+ extern long long unsigned int lipgloss_style_margin_left(long long unsigned int id, int value);
168
+ extern long long unsigned int lipgloss_style_margin_background(long long unsigned int id, char* color);
169
+ extern long long unsigned int lipgloss_style_unset_bold(long long unsigned int id);
170
+ extern long long unsigned int lipgloss_style_unset_italic(long long unsigned int id);
171
+ extern long long unsigned int lipgloss_style_unset_underline(long long unsigned int id);
172
+ extern long long unsigned int lipgloss_style_unset_strikethrough(long long unsigned int id);
173
+ extern long long unsigned int lipgloss_style_unset_reverse(long long unsigned int id);
174
+ extern long long unsigned int lipgloss_style_unset_blink(long long unsigned int id);
175
+ extern long long unsigned int lipgloss_style_unset_faint(long long unsigned int id);
176
+ extern long long unsigned int lipgloss_style_unset_foreground(long long unsigned int id);
177
+ extern long long unsigned int lipgloss_style_unset_background(long long unsigned int id);
178
+ extern long long unsigned int lipgloss_style_unset_width(long long unsigned int id);
179
+ extern long long unsigned int lipgloss_style_unset_height(long long unsigned int id);
180
+ extern long long unsigned int lipgloss_style_unset_padding_top(long long unsigned int id);
181
+ extern long long unsigned int lipgloss_style_unset_padding_right(long long unsigned int id);
182
+ extern long long unsigned int lipgloss_style_unset_padding_bottom(long long unsigned int id);
183
+ extern long long unsigned int lipgloss_style_unset_padding_left(long long unsigned int id);
184
+ extern long long unsigned int lipgloss_style_unset_margin_top(long long unsigned int id);
185
+ extern long long unsigned int lipgloss_style_unset_margin_right(long long unsigned int id);
186
+ extern long long unsigned int lipgloss_style_unset_margin_bottom(long long unsigned int id);
187
+ extern long long unsigned int lipgloss_style_unset_margin_left(long long unsigned int id);
188
+ extern long long unsigned int lipgloss_style_unset_border_style(long long unsigned int id);
189
+ extern long long unsigned int lipgloss_style_unset_inline(long long unsigned int id);
190
+ extern long long unsigned int lipgloss_table_new();
191
+ extern void lipgloss_table_free(long long unsigned int id);
192
+ extern long long unsigned int lipgloss_table_headers(long long unsigned int id, char* headersJSON);
193
+ extern long long unsigned int lipgloss_table_row(long long unsigned int id, char* rowJSON);
194
+ extern long long unsigned int lipgloss_table_rows(long long unsigned int id, char* rowsJSON);
195
+ extern long long unsigned int lipgloss_table_border(long long unsigned int id, int borderType);
196
+ extern long long unsigned int lipgloss_table_border_style(long long unsigned int id, long long unsigned int styleID);
197
+ extern long long unsigned int lipgloss_table_border_top(long long unsigned int id, int value);
198
+ extern long long unsigned int lipgloss_table_border_bottom(long long unsigned int id, int value);
199
+ extern long long unsigned int lipgloss_table_border_left(long long unsigned int id, int value);
200
+ extern long long unsigned int lipgloss_table_border_right(long long unsigned int id, int value);
201
+ extern long long unsigned int lipgloss_table_border_header(long long unsigned int id, int value);
202
+ extern long long unsigned int lipgloss_table_border_column(long long unsigned int id, int value);
203
+ extern long long unsigned int lipgloss_table_border_row(long long unsigned int id, int value);
204
+ extern long long unsigned int lipgloss_table_width(long long unsigned int id, int width);
205
+ extern long long unsigned int lipgloss_table_height(long long unsigned int id, int height);
206
+ extern long long unsigned int lipgloss_table_offset(long long unsigned int id, int offset);
207
+ extern long long unsigned int lipgloss_table_wrap(long long unsigned int id, int value);
208
+ extern long long unsigned int lipgloss_table_clear_rows(long long unsigned int id);
209
+ extern char* lipgloss_table_render(long long unsigned int id);
210
+ extern long long unsigned int lipgloss_table_style_func(long long unsigned int id, char* styleMapJSON);
211
+ extern long long unsigned int lipgloss_tree_new();
212
+ extern long long unsigned int lipgloss_tree_root(char* root);
213
+ extern void lipgloss_tree_free(long long unsigned int id);
214
+ extern long long unsigned int lipgloss_tree_set_root(long long unsigned int id, char* root);
215
+ extern long long unsigned int lipgloss_tree_child(long long unsigned int id, char* child);
216
+ extern long long unsigned int lipgloss_tree_child_tree(long long unsigned int id, long long unsigned int childTreeID);
217
+ extern long long unsigned int lipgloss_tree_children(long long unsigned int id, char* childrenJSON);
218
+ extern long long unsigned int lipgloss_tree_enumerator(long long unsigned int id, int enumType);
219
+ extern long long unsigned int lipgloss_tree_enumerator_style(long long unsigned int id, long long unsigned int styleID);
220
+ extern long long unsigned int lipgloss_tree_item_style(long long unsigned int id, long long unsigned int styleID);
221
+ extern long long unsigned int lipgloss_tree_root_style(long long unsigned int id, long long unsigned int styleID);
222
+ extern long long unsigned int lipgloss_tree_offset(long long unsigned int id, int start, int end);
223
+ extern char* lipgloss_tree_render(long long unsigned int id);
224
+
225
+ #ifdef __cplusplus
226
+ }
227
+ #endif
data/go/go.mod ADDED
@@ -0,0 +1,20 @@
1
+ module github.com/marcoroth/lipgloss-ruby/go
2
+
3
+ go 1.23.0
4
+
5
+ require github.com/charmbracelet/lipgloss v1.1.0
6
+
7
+ require (
8
+ github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
9
+ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
10
+ github.com/charmbracelet/x/ansi v0.8.0 // indirect
11
+ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
12
+ github.com/charmbracelet/x/term v0.2.1 // indirect
13
+ github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
14
+ github.com/mattn/go-isatty v0.0.20 // indirect
15
+ github.com/mattn/go-runewidth v0.0.16 // indirect
16
+ github.com/muesli/termenv v0.16.0 // indirect
17
+ github.com/rivo/uniseg v0.4.7 // indirect
18
+ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
19
+ golang.org/x/sys v0.30.0 // indirect
20
+ )