mirror of
https://github.com/fluencelabs/sqlite
synced 2025-04-24 17:02:14 +00:00
move to the new sdk
This commit is contained in:
parent
eaa210ca74
commit
3dc83269a5
90
.gitignore
vendored
90
.gitignore
vendored
@ -1,88 +1,6 @@
|
||||
.*.swp
|
||||
*.o
|
||||
*.log
|
||||
dump.rdb
|
||||
redis-benchmark
|
||||
redis-check-aof
|
||||
redis-check-rdb
|
||||
redis-check-dump
|
||||
redis-cli
|
||||
redis-sentinel
|
||||
redis-server
|
||||
doc-tools
|
||||
release
|
||||
misc/*
|
||||
src/release.h
|
||||
appendonly.aof
|
||||
SHORT_TERM_TODO
|
||||
release.h
|
||||
src/transfer.sh
|
||||
src/configs
|
||||
redis.ds
|
||||
src/redis.conf
|
||||
src/nodes.conf
|
||||
deps/lua/src/lua
|
||||
deps/lua/src/luac
|
||||
deps/lua/src/liblua.a
|
||||
.make-*
|
||||
.prerequisites
|
||||
*.dSYM
|
||||
Makefile.dep
|
||||
|
||||
|
||||
### C++ template
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
.idea/*
|
||||
cmake-build-debug
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
.idea
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
# Wasm files
|
||||
*.wasm
|
||||
*.wat
|
||||
|
@ -4,8 +4,7 @@ RUN apt-get update \
|
||||
&& apt-get install -y ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
make \
|
||||
libtinfo5
|
||||
make
|
||||
|
||||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-10/wasi-sdk-10.0-linux.tar.gz | tar xz --strip-components=1 -C /
|
||||
|
||||
|
5
Makefile
5
Makefile
@ -129,17 +129,16 @@ SQLITE_FLAGS = \
|
||||
-DSQLITE_ENABLE_DESERIALIZE\
|
||||
-DSQLITE_INTROSPECTION_PRAGMAS\
|
||||
-DSQLITE_OMIT_POPEN
|
||||
SDK = sdk/logger.c
|
||||
|
||||
.PHONY: default all clean
|
||||
|
||||
default: $(TARGET)
|
||||
all: default
|
||||
|
||||
$(TARGET): $(SDK) $(SQLITE_SRC) $(WRAPPER_SRC)
|
||||
$(TARGET): $(SQLITE_SRC) $(WRAPPER_SRC)
|
||||
$(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) $(SQLITE_FLAGS) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm
|
||||
|
||||
.PRECIOUS: $(TARGET)
|
||||
|
||||
clean:
|
||||
-rm -f $(TARGET).wasm
|
||||
-rm -f $(TARGET).wasm $(TARGET).wat
|
||||
|
15
sdk/logger.c
15
sdk/logger.c
@ -1,15 +0,0 @@
|
||||
#include "logger.h"
|
||||
|
||||
#define __LOGGER_IMPORT(name) \
|
||||
__attribute__((__import_module__("logger"), __import_name__(#name)))
|
||||
|
||||
void __write(char ch) __LOGGER_IMPORT(write);
|
||||
void __flush() __LOGGER_IMPORT(flush);
|
||||
|
||||
void wasm_log(const char *str, int len) {
|
||||
for(int byteId = 0; byteId < len; ++byteId) {
|
||||
__write(str[byteId]);
|
||||
}
|
||||
|
||||
__flush();
|
||||
}
|
16
sdk/logger.h
16
sdk/logger.h
@ -1,11 +1,15 @@
|
||||
#ifndef C_SDK_LOGGER_H
|
||||
#define C_SDK_LOGGER_H
|
||||
#ifndef FLUENCE_C_SDK_LOGGER_H
|
||||
#define FLUENCE_C_SDK_LOGGER_H
|
||||
|
||||
#define __LOGGER_IMPORT(name) \
|
||||
__attribute__((__import_module__("logger"), __import_name__(#name)))
|
||||
|
||||
/**
|
||||
* Writes provided string to Wasm VM logger.
|
||||
* Writes provided utf8 string to Wasm VM logger.
|
||||
*
|
||||
* @param log_message a message that should be logged.
|
||||
* @param str a pointer to the string that should be logged.
|
||||
* @param len a size of the string that should be logged.
|
||||
*/
|
||||
void wasm_log(const char *str, int len);
|
||||
void log_utf8_string(const char *str, int len) __LOGGER_IMPORT(log_utf8_string);
|
||||
|
||||
#endif //C_SDK_LOGGER_H
|
||||
#endif // FLUENCE_C_SDK_LOGGER_H
|
||||
|
@ -111,13 +111,13 @@ const char *invoke(char *request, int request_size) {
|
||||
// TODO: check the return code
|
||||
init();
|
||||
const char successInitMessage[] = "Sqlite has been initialized";
|
||||
wasm_log(successInitMessage, sizeof(successInitMessage));
|
||||
log_utf8_string(successInitMessage, sizeof(successInitMessage));
|
||||
g_isInited = 1;
|
||||
}
|
||||
|
||||
request[request_size] = 0;
|
||||
|
||||
wasm_log(request, request_size);
|
||||
log_utf8_string(request, request_size);
|
||||
|
||||
ShellText str;
|
||||
initText(&str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user