Mercurial > core / lisp/ffi/tree-sitter/alien.c
changeset 698: |
96958d3eb5b0 |
parent: |
08621be7e780
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 //! tree-sitter/alien.c --- Tree-sitter C wrapper 3 // based on https://github.com/death/cl-tree-sitter 5 // it's annoying that we need this, I thought we could get away 6 // without it. Alas, SB-ALIEN is also unable to fully interoperate 7 // with the types defined in api.h, so we need to manually create 8 // pointer type definitions for them. 12 cc -g -O2 -Wall -Wno-unused-value -ltree-sitter -shared lisp/ffi/tree-sitter/alien.c \ 13 -o .stash/libtree-sitter-alien.so 17 #include <tree_sitter/api.h> 18 TSNode *ts_tree_root_node_pointer(const TSTree *self) { 19 TSNode *node = malloc(sizeof(TSNode)); 22 *node = ts_tree_root_node(self); 28 TSTreeCursor *ts_tree_cursor_new_pointer(TSNode *node) { 29 TSTreeCursor *cursor = malloc(sizeof(TSTreeCursor)); 32 *cursor = ts_tree_cursor_new(*node); 38 TSNode *ts_tree_cursor_current_node_pointer(const TSTreeCursor *cursor) { 39 TSNode *return_node = malloc(sizeof(TSNode)); 42 *return_node = ts_tree_cursor_current_node(cursor); 48 int ts_node_is_named_pointer(TSNode *node) { 49 return ts_node_is_named(*node); 52 TSPoint ts_node_start_point_pointer(TSNode *node) { 53 return ts_node_start_point(*node); 57 TSPoint ts_node_end_point_pointer(TSNode *node) { 58 return ts_node_end_point(*node); 61 const char *ts_node_type_pointer(TSNode *node) { 62 return ts_node_type(*node);