tree_sitter_c2rust/core_wrapper/
mod.rs

1#[cfg(feature = "capi")]
2pub(crate) mod capi;
3
4pub(crate) mod alloc;
5pub(crate) mod util;
6
7pub mod core {
8    #![allow(dead_code)]
9    #![allow(mutable_transmutes)]
10    #![allow(non_camel_case_types)]
11    #![allow(non_snake_case)]
12    #![allow(non_upper_case_globals)]
13    #![allow(unused_assignments)]
14    #![allow(unused_mut)]
15    #![allow(ambiguous_glob_reexports)]
16    #![allow(invalid_reference_casting)]
17    #![allow(static_mut_refs)]
18
19    pub use c2rust_bitfields::*;
20
21    #[allow(unused, clippy::all)]
22    pub(crate) mod api_raw;
23    #[allow(unused, clippy::all)]
24    pub(crate) mod get_changed_ranges;
25    #[allow(unused, clippy::all)]
26    pub(crate) mod language;
27    #[allow(unused, clippy::all)]
28    pub(crate) mod lexer;
29    #[allow(unused, clippy::all)]
30    pub(crate) mod node;
31    #[allow(unused, clippy::all)]
32    pub(crate) mod parser;
33    #[allow(unused, clippy::all)]
34    pub(crate) mod query;
35    #[allow(unused, clippy::all)]
36    pub(crate) mod stack;
37    #[allow(unused, clippy::all)]
38    pub(crate) mod subtree;
39    #[allow(unused, clippy::all)]
40    pub(crate) mod tree;
41    #[allow(unused, clippy::all)]
42    pub(crate) mod tree_cursor;
43    #[allow(unused, clippy::all)]
44    pub(crate) mod wasm_store;
45
46    pub(crate) use crate::core_wrapper::alloc;
47    pub(crate) use crate::core_wrapper::util;
48
49    #[no_mangle]
50    pub static ts_current_free: unsafe extern "C" fn(*mut std::ffi::c_void) = ts_free;
51
52    #[no_mangle]
53    pub static ts_current_malloc: unsafe extern "C" fn(usize) -> *mut std::ffi::c_void = ts_malloc;
54
55    #[no_mangle]
56    pub static ts_current_calloc: unsafe extern "C" fn(usize, usize) -> *mut std::ffi::c_void =
57        ts_calloc;
58
59    #[no_mangle]
60    pub static ts_current_realloc: unsafe extern "C" fn(
61        *mut std::ffi::c_void,
62        usize,
63    ) -> *mut std::ffi::c_void = ts_realloc;
64
65    #[cfg(feature = "capi")]
66    #[cfg(unix)]
67    #[no_mangle]
68    pub unsafe extern "C" fn _ts_dup(mut file_descriptor: util::libc::c_int) -> util::libc::c_int {
69        return util::libc::dup(file_descriptor);
70    }
71
72    #[cfg(feature = "capi")]
73    #[cfg(windows)]
74    #[no_mangle]
75    pub unsafe extern "C" fn _ts_dup(
76        mut file_descriptor: std::os::windows::raw::HANDLE,
77    ) -> util::libc::c_int {
78        panic!("Not implemented for Windows");
79    }
80
81    #[cfg(feature = "capi")]
82    #[cfg(unix)]
83    #[no_mangle]
84    pub unsafe extern "C" fn ts_tree_print_dot_graph(
85        mut self_0: *const TSTree,
86        mut file_descriptor: util::libc::c_int,
87    ) {
88        let mut file: *mut util::libc::FILE = util::libc::fdopen(
89            _ts_dup(file_descriptor),
90            b"a\0" as *const u8 as *const util::libc::c_char,
91        );
92        ts_subtree_print_dot_graph((*self_0).root, (*self_0).language, file);
93        util::libc::fclose(file);
94    }
95
96    #[cfg(feature = "capi")]
97    #[cfg(not(unix))]
98    #[no_mangle]
99    pub unsafe extern "C" fn ts_tree_print_dot_graph(
100        mut _self_0: *const TSTree,
101        mut _fd: util::libc::c_int,
102    ) {
103        panic!("Not implemented for Windows");
104    }
105
106    pub use alloc::*;
107    pub use api_raw::*;
108    pub use get_changed_ranges::*;
109    pub use language::*;
110    pub use lexer::*;
111    pub use node::*;
112    pub use parser::*;
113    pub use query::*;
114    pub use stack::*;
115    pub use subtree::*;
116    pub use tree::*;
117    pub use tree_cursor::*;
118    pub use wasm_store::*;
119
120    #[cfg(feature = "capi")]
121    pub use crate::core_wrapper::capi::*;
122
123    pub(crate) mod defines;
124    pub use defines::*;
125
126    #[repr(C)]
127    #[derive(Debug, Copy, Clone)]
128    pub struct TSLookaheadIterator {
129        _unused: [u8; 0],
130    }
131
132    #[repr(C)]
133    #[derive(Debug, Copy, Clone)]
134    pub struct TSWasmStore {}
135}