mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
* feat(wasm): make syntax trees sendable
* test(wasm): transfer trees across workers
* test(wasm): use JSON grammar for tree transfer
* test(wasm): edit trees across workers
* test(wasm): share dlmalloc with tree-sitter
* test(wasm): simplify worker tree exchange
* test(wasm): drive tree exchange from Rust
* test(wasm): split sendable-tree xtask
* test(wasm): generalize Rust web fixture
* test(wasm): exercise parallel Rust tree access
* fix(wasm): use Rust global allocator for C core
* test(wasm): use default Rust allocator
* feat(wasm): support external scanners in Rust web apps
* Simplify example further, add a readme
* Regenerate wasm-stdlib
* Fix wasm_stdlib check script
* Vendor the Wasm standard library subset
* Test Unicode Ruby scanner behavior in Wasm
* Make Wasm tree languages instance-aware
* Test multi-threaded use of queries in wasm32-unknown
* Refactor reference-counted language storage
* Check ABI version compat before loading rest of language
* 🎨 Remove redundant #ifdef block
* Reject unsupported Rust Wasm builds on 0.26
50 lines
1.6 KiB
C
50 lines
1.6 KiB
C
#ifndef TREE_SITTER_WASM_STRING_H_
|
|
#define TREE_SITTER_WASM_STRING_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef NULL
|
|
#define NULL ((void *)0)
|
|
#endif
|
|
|
|
#ifndef weak_alias
|
|
#define weak_alias(old, new) \
|
|
extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
|
|
#endif
|
|
|
|
#if defined(TREE_SITTER_WASM_STDLIB) && !defined(TS_WASM_EXPORT)
|
|
#define TS_WASM_EXPORT(name) __attribute__((visibility("default"), export_name(name)))
|
|
#elif !defined(TS_WASM_EXPORT)
|
|
#define TS_WASM_EXPORT(name)
|
|
#endif
|
|
|
|
TS_WASM_EXPORT("memchr") void *memchr(const void *src, int c, size_t n);
|
|
|
|
TS_WASM_EXPORT("memcmp") int memcmp(const void *lhs, const void *rhs, size_t count);
|
|
|
|
TS_WASM_EXPORT("memcpy") void *memcpy(void *restrict dst, const void *restrict src, size_t size);
|
|
|
|
TS_WASM_EXPORT("memmove") void *memmove(void *dst, const void *src, size_t count);
|
|
|
|
TS_WASM_EXPORT("memset") void *memset(void *dst, int value, size_t count);
|
|
|
|
TS_WASM_EXPORT("strchr") char *strchr(const char *str, int c);
|
|
|
|
TS_WASM_EXPORT("strcmp") int strcmp(const char *left, const char *right);
|
|
|
|
TS_WASM_EXPORT("strlen") size_t strlen(const char *str);
|
|
|
|
TS_WASM_EXPORT("strncat") char *strncat(char *restrict dest, const char *restrict src, size_t count);
|
|
|
|
TS_WASM_EXPORT("strncmp") int strncmp(const char *left, const char *right, size_t n);
|
|
|
|
char *__stpncpy(char *restrict dest, const char *restrict src, size_t count);
|
|
|
|
char *__strchrnul(const char *str, int c);
|
|
|
|
char *stpncpy(char *restrict dest, const char *restrict src, size_t count);
|
|
|
|
TS_WASM_EXPORT("strncpy") char *strncpy(char *restrict dest, const char *restrict src, size_t count);
|
|
|
|
#endif // TREE_SITTER_WASM_STRING_H_
|