fix rust parser on wasm32 target
This commit is contained in:
parent
dd60d5cff0
commit
1132e9fa28
5 changed files with 10 additions and 8 deletions
|
|
@ -13,4 +13,6 @@ void *memset(void *dst, int value, size_t count);
|
|||
|
||||
int strncmp(const char *left, const char *right, size_t n);
|
||||
|
||||
size_t strlen(const char *str);
|
||||
|
||||
#endif // TREE_SITTER_WASM_STRING_H_
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
bool left_justify; // -
|
||||
|
|
@ -105,12 +106,6 @@ static int ptr_to_str(void *ptr, char *buffer) {
|
|||
return 2 + len;
|
||||
}
|
||||
|
||||
size_t strlen(const char *str) {
|
||||
const char *s = str;
|
||||
while (*s) s++;
|
||||
return s - str;
|
||||
}
|
||||
|
||||
char *strncpy(char *dest, const char *src, size_t n) {
|
||||
char *d = dest;
|
||||
const char *s = src;
|
||||
|
|
|
|||
|
|
@ -58,3 +58,9 @@ int strncmp(const char *left, const char *right, size_t n) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t strlen(const char *str) {
|
||||
const char *s = str;
|
||||
while (*s) s++;
|
||||
return s - str;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#endif
|
||||
|
||||
#if !defined(TS_PTR_SIZE)
|
||||
#if UINTPTR_MAX == 0xFFFFFFFF
|
||||
#if UINTPTR_MAX == UINT64_MAX
|
||||
#define TS_PTR_SIZE 32
|
||||
#else
|
||||
#define TS_PTR_SIZE 64
|
||||
|
|
|
|||
|
|
@ -276,7 +276,6 @@ static wasm_trap_t *callback__debug_message(
|
|||
uint32_t string_address = args_and_results[0].i32;
|
||||
uint32_t value = args_and_results[1].i32;
|
||||
uint8_t *memory = wasmtime_memory_data(context, &store->memory);
|
||||
printf("DEBUG: %s %u\n", &memory[string_address], value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue