trimmed more fat

This commit is contained in:
Maieul BOYER 2024-06-30 19:37:09 +02:00
parent d9bf7fa721
commit 5898689697
No known key found for this signature in database
14 changed files with 432 additions and 3151 deletions

View file

@ -4,7 +4,6 @@
#include "./array.h"
#include "./length.h"
#include "./subtree.h"
#include "./tree_cursor.h"
#include "api.h"
TSTree *ts_tree_new(Subtree root, const TSLanguage *language, const TSRange *included_ranges, unsigned included_range_count)
@ -106,51 +105,7 @@ TSRange *ts_tree_included_ranges(const TSTree *self, uint32_t *length)
return ranges;
}
// TSRange *ts_tree_get_changed_ranges(const TSTree *old_tree, const TSTree *new_tree, uint32_t *length)
// {
// TreeCursor cursor1 = {NULL, array_new(), 0};
// TreeCursor cursor2 = {NULL, array_new(), 0};
// ts_tree_cursor_init(&cursor1, ts_tree_root_node(old_tree));
// ts_tree_cursor_init(&cursor2, ts_tree_root_node(new_tree));
// TSRangeArray included_range_differences = array_new();
// ts_range_array_get_changed_ranges(old_tree->included_ranges, old_tree->included_range_count, new_tree->included_ranges,
// new_tree->included_range_count, &included_range_differences);
// TSRange *result;
// *length = ts_subtree_get_changed_ranges(&old_tree->root, &new_tree->root, &cursor1, &cursor2, old_tree->language,
// &included_range_differences, &result);
// array_delete(&included_range_differences);
// array_delete(&cursor1.stack);
// array_delete(&cursor2.stack);
// return result;
// }
#ifdef _WIN32
# include <io.h>
# include <windows.h>
int _ts_dup(HANDLE handle)
{
HANDLE dup_handle;
if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), &dup_handle, 0, FALSE, DUPLICATE_SAME_ACCESS))
return -1;
return _open_osfhandle((intptr_t)dup_handle, 0);
}
void ts_tree_print_dot_graph(const TSTree *self, int fd)
{
FILE *file = _fdopen(_ts_dup((HANDLE)_get_osfhandle(fd)), "a");
ts_subtree_print_dot_graph(self->root, self->language, file);
fclose(file);
}
#else
# include <unistd.h>
#include <unistd.h>
int _ts_dup(int file_descriptor)
{
@ -163,5 +118,3 @@ void ts_tree_print_dot_graph(const TSTree *self, int file_descriptor)
ts_subtree_print_dot_graph(self->root, self->language, file);
fclose(file);
}
#endif