line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
// Copyright (c) 2023 Yuki Kimoto |
2
|
|
|
|
|
|
|
// MIT License |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#include |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#include "spvm_native.h" |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "spvm_api_string_buffer.h" |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "spvm_allocator.h" |
11
|
|
|
|
|
|
|
#include "spvm_string_buffer.h" |
12
|
|
|
|
|
|
|
|
13
|
119269
|
|
|
|
|
|
SPVM_API_STRING_BUFFER* SPVM_API_STRING_BUFFER_new_api() { |
14
|
119269
|
|
|
|
|
|
void* env_string_buffer_init[] = { |
15
|
|
|
|
|
|
|
SPVM_API_STRING_BUFFER_new_instance, |
16
|
|
|
|
|
|
|
SPVM_API_STRING_BUFFER_free_instance, |
17
|
|
|
|
|
|
|
SPVM_API_STRING_BUFFER_get_string, |
18
|
|
|
|
|
|
|
SPVM_API_STRING_BUFFER_get_length, |
19
|
|
|
|
|
|
|
}; |
20
|
119269
|
|
|
|
|
|
SPVM_API_STRING_BUFFER* env_string_buffer = calloc(1, sizeof(env_string_buffer_init)); |
21
|
119269
|
|
|
|
|
|
memcpy(env_string_buffer, env_string_buffer_init, sizeof(env_string_buffer_init)); |
22
|
|
|
|
|
|
|
|
23
|
119269
|
|
|
|
|
|
return env_string_buffer; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
522
|
|
|
|
|
|
SPVM_STRING_BUFFER* SPVM_API_STRING_BUFFER_new_instance(SPVM_ALLOCATOR* allocator, int32_t capacity) { |
27
|
522
|
|
|
|
|
|
SPVM_STRING_BUFFER* string_buffer = SPVM_STRING_BUFFER_new_tmp(allocator, capacity); |
28
|
|
|
|
|
|
|
|
29
|
522
|
|
|
|
|
|
return string_buffer; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
522
|
|
|
|
|
|
const char* SPVM_API_STRING_BUFFER_get_string(SPVM_STRING_BUFFER* string_buffer) { |
33
|
522
|
|
|
|
|
|
return string_buffer->string; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
522
|
|
|
|
|
|
int32_t SPVM_API_STRING_BUFFER_get_length(SPVM_STRING_BUFFER* string_buffer) { |
37
|
522
|
|
|
|
|
|
return string_buffer->length; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
522
|
|
|
|
|
|
void SPVM_API_STRING_BUFFER_free_instance(SPVM_STRING_BUFFER* string_buffer) { |
41
|
522
|
|
|
|
|
|
SPVM_STRING_BUFFER_free(string_buffer); |
42
|
522
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
119269
|
|
|
|
|
|
void SPVM_API_STRING_BUFFER_free_api(SPVM_API_STRING_BUFFER* api) { |
45
|
119269
|
|
|
|
|
|
free(api); |
46
|
119269
|
|
|
|
|
|
} |