summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/README.md17
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore1
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt91
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md51
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh63
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh3
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c217
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c95
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c90
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/CMakeLists.txt9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/README.md112
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/CMakeLists.txt91
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/main.c113
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/CMakeLists.txt26
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/main.c187
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/README.md138
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/build.sh75
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_conf.h498
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_drv_conf.h310
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/system_header.h9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wamr_config_gui.cmake9
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/build_apps.sh45
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/Makefile29
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/src/main.c84
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/CMakeLists.txt20
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/Makefile34
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/src/main.c84
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/iwasm_main.c564
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/lv_drv_conf.h310
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/main.c25
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/LICENSE202
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c344
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.h65
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/board_config.h9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display.h418
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.c283
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h70
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340_adafruit_1480.c80
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c190
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/main.c29
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_jlf.h26
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_stm32.h30
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/LICENCE.txt8
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/README.md174
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/build.sh102
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_conf.h389
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_drv_conf.h310
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt137
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt.in18
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/.gitignore1
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/display_indev.h28
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.c96
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.h73
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/linux_display_indev.c319
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/system_header.h9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/main.c170
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/CMakeLists.txt36
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/display_indev.h96
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/display_indev.c347
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/iwasm_main.c544
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/main.c11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/mouse.c97
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/LICENSE202
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c345
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.h87
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/board_config.h9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display.h418
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.c284
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h70
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340_adafruit_1480.c80
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_indev.c105
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c131
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/main.c26
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_jlf.h26
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_stm32.h30
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wamr_config_littlevgl.cmake9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app57
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app_no_wasi59
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/build_wasm_app.sh22
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/display_indev.h42
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/main.c189
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/system_header.h9
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/CMakeLists.txt159
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/src/main.c167
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/CMakeLists.txt89
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mA.c13
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mB.c23
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mC.c51
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mD.cpp74
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp45
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/CMakeLists.txt81
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/CMakeLists.txt46
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main.c92
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_global_atomic.c48
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_thread_exception.c36
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/CMakeLists.txt91
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/README.md76
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_add.c32
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello.c34
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello2.c59
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_sqrt.c32
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/CMakeLists.txt35
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/main.c70
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/CMakeLists.txt139
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.c288
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.wat44
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/CMakeLists.txt78
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/README.md203
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/CMakeLists.txt38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/main.c117
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore1
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt40
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md342
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh166
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake40
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake12
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake12
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake11
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py224
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c568
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c14
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c89
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c54
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c29
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c59
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c52
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c83
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c34
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/CMakeLists.txt195
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/README.md212
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/sample_test_run.py141
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/CMakeLists.txt91
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/addr_resolve.c69
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/inc/.gitkeep0
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_client.c135
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_server.c120
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/send_recv.c219
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_opts.c299
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_utils.h48
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_client.c106
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_server.c152
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_client.c111
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_server.c69
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_client.c84
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_server.c122
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/CMakeLists.txt79
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/src/main.c242
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/CMakeLists.txt38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/sum.c16
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/CMakeLists.txt80
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/README.md22
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/CMakeLists.txt46
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/no_pthread.c74
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.S22
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.h32
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/.gitignore2
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/CMakeLists.txt174
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/README.md174
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/CMakeLists.txt12
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/example1.c204
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/CMakeLists.txt47
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/inc/.gitkeep0
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/send_recv.c244
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/CMakeLists.txt210
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/README.md50
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/LICENSE202
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.c193
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.wat10
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.c294
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.wat32
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.c535
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.wat15
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.c122
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.wat5
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.c278
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.wat27
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-0.wat8
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-1.wat10
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport.c192
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.c138
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.wat4
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.c308
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.wat24
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.c235
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.wat11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.c163
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.wat7
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.c207
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.wat6
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.c131
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.wat4
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.c218
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.wat12
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.c187
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.wat5
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.c184
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.wat5
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/utils/multi_module_utils.c47
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/CMakeLists.txt116
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/README.md34
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/.gitignore2
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/CMakeLists.txt147
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/README.md48
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/benchmark.patch14
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/xnnpack.patch141
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/.gitignore4
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.bwa_wasm.txt124
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.txt73
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/README.md46
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/bwa.patch13
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindBinaryen.cmake43
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindWASISDK.cmake38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/include/.gitkeep0
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/.gitignore2
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/CMakeLists.txt38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md57
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/codecbench.patch119
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/preparation.sh107
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/README.md19
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/build.sh157
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/tf_lite.patch84
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/.gitignore8
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.avx_wasm.txt72
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.txt44
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/README.md54
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/av1-clang.patch19
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/build.sh100
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/wasm-av1.patch701
233 files changed, 0 insertions, 24694 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/README.md
deleted file mode 100644
index 21a735268..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-
-# Samples
-- [**basic**](./basic): Demonstrating how to use runtime exposed API's to call WASM functions, how to register native functions and call them, and how to call WASM function from native function.
-- **[simple](./simple/README.md)**: The runtime is integrated with most of the WAMR APP libraries, and a few WASM applications are provided for testing the WAMR APP API set. It uses **built-in libc** and executes apps in **interpreter** mode by default.
-- **[file](./file/README.md)**: Demonstrating the supported file interaction API of WASI. This sample can also demonstrate the SGX IPFS (Intel Protected File System), enabling an enclave to seal and unseal data at rest.
-- **[littlevgl](./littlevgl/README.md)**: Demonstrating the graphic user interface application usage on WAMR. The whole [LVGL](https://github.com/lvgl/lvgl) 2D user graphic library and the UI application are built into WASM application. It uses **WASI libc** and executes apps in **AOT mode** by default.
-- **[gui](./gui/README.md)**: Move the [LVGL](https://github.com/lvgl/lvgl) library into the runtime and define a WASM application interface by wrapping the littlevgl API. It uses **WASI libc** and executes apps in **interpreter** mode by default.
-- **[multi-thread](./multi-thread/)**: Demonstrating how to run wasm application which creates multiple threads to execute wasm functions concurrently, and uses mutex/cond by calling pthread related API's.
-- **[spawn-thread](./spawn-thread)**: Demonstrating how to execute wasm functions of the same wasm application concurrently, in threads created by host embedder or runtime, but not the wasm application itself.
-- **[wasi-threads](./wasi-threads/README.md)**: Demonstrating how to run wasm application which creates multiple threads to execute wasm functions concurrently based on lib wasi-threads.
-- **[multi-module](./multi-module)**: Demonstrating the [multiple modules as dependencies](./doc/multi_module.md) feature which implements the [load-time dynamic linking](https://webassembly.org/docs/dynamic-linking/).
-- **[ref-types](./ref-types)**: Demonstrating how to call wasm functions with argument of externref type introduced by [reference types proposal](https://github.com/WebAssembly/reference-types).
-- **[wasm-c-api](./wasm-c-api/README.md)**: Demonstrating how to run some samples from [wasm-c-api proposal](https://github.com/WebAssembly/wasm-c-api) and showing the supported API's.
-- **[socket-api](./socket-api/README.md)**: Demonstrating how to run wasm tcp server and tcp client applications, and how they communicate with each other.
-- **[native-lib](./native-lib/README.md)**: Demonstrating how to write required interfaces in native library, build it into a shared library and register the shared library to iwasm.
-- **[sgx-ra](./sgx-ra/README.md)**: Demonstrating how to execute Remote Attestation on SGX with [librats](https://github.com/inclavare-containers/librats), which enables mutual attestation with other runtimes or other entities that support librats to ensure that each is running within the TEE.
-- **[workload](./workload/README.md)**: Demonstrating how to build and run some complex workloads, e.g. tensorflow-lite, XNNPACK, wasm-av1, meshoptimizer and bwa.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore
deleted file mode 100644
index 0fa8a76bd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/out/ \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt
deleted file mode 100644
index 4191ad15d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-include(CheckPIESupported)
-
-if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
- project (basic)
-else()
- project (basic C ASM)
- enable_language (ASM_MASM)
-endif()
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-
-if (NOT MSVC)
- set (WAMR_BUILD_LIBC_WASI 1)
-endif ()
-
-if (NOT MSVC)
- # linker flags
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
- endif ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
- if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
- endif ()
- endif ()
-endif ()
-
-# build out vmlib
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-
-################ application related ################
-include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-add_executable (basic src/main.c src/native_impl.c ${UNCOMMON_SHARED_SOURCE})
-
-check_pie_supported()
-set_target_properties (basic PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-if (APPLE)
- target_link_libraries (basic vmlib -lm -ldl -lpthread)
-else ()
- target_link_libraries (basic vmlib -lm -ldl -lpthread -lrt)
-endif ()
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md
deleted file mode 100644
index 32e7ed650..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-The "basic" sample project
-==============
-
-This sample demonstrates a few basic usages of embedding WAMR:
-- initialize runtime
-- load wasm app and instantiate the module
-- call wasm function and pass arguments
-- export native functions to the WASM apps
-- wasm function calls native function and pass arguments
-- deinitialize runtime
-
-Build this sample
-==============
-Execute the ```build.sh``` script then all binaries including wasm application files would be generated in 'out' directory.
-
-```
-$ ./build.sh
-```
-
-Run the sample
-==========================
-Enter the out directory.
-```
-$ cd ./out/
-$
-$ ./basic -f wasm-apps/testapp.wasm
-calling into WASM function: generate_float
-Native finished calling wasm function generate_float(), returned a float value: 102009.921875f
-calling into WASM function: float_to_string
-calling into native function: intToStr
-calling into native function: get_pow
-calling into native function: intToStr
-Native finished calling wasm function: float_to_string, returned a formatted string: 102009.921
-```
-Or execute the ```run.sh``` script in ```samples/basic``` folder.
-```
-$ ./run.sh
-calling into WASM function: generate_float
-Native finished calling wasm function generate_float(), returned a float value: 102009.921875f
-calling into WASM function: float_to_string
-calling into native function: intToStr
-calling into native function: get_pow
-calling into native function: intToStr
-Native finished calling wasm function: float_to_string, returned a formatted string: 102009.921
-```
-
-
-
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh
deleted file mode 100755
index a0be7e1c7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-CURR_DIR=$PWD
-WAMR_DIR=${PWD}/../..
-OUT_DIR=${PWD}/out
-
-WASM_APPS=${PWD}/wasm-apps
-
-
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-mkdir ${OUT_DIR}/wasm-apps
-
-
-echo "#####################build basic project"
-cd ${CURR_DIR}
-mkdir -p cmake_build
-cd cmake_build
-cmake ..
-make -j ${nproc}
-if [ $? != 0 ];then
- echo "BUILD_FAIL basic exit as $?\n"
- exit 2
-fi
-
-cp -a basic ${OUT_DIR}
-
-echo -e "\n"
-
-echo "#####################build wasm apps"
-
-cd ${WASM_APPS}
-
-for i in `ls *.c`
-do
-APP_SRC="$i"
-OUT_FILE=${i%.*}.wasm
-
-# use WAMR SDK to build out the .wasm binary
-/opt/wasi-sdk/bin/clang \
- --target=wasm32 -O0 -z stack-size=4096 -Wl,--initial-memory=65536 \
- --sysroot=${WAMR_DIR}/wamr-sdk/app/libc-builtin-sysroot \
- -Wl,--allow-undefined-file=${WAMR_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt \
- -Wl,--strip-all,--no-entry -nostdlib \
- -Wl,--export=generate_float \
- -Wl,--export=float_to_string \
- -Wl,--export=calculate\
- -Wl,--allow-undefined \
- -o ${OUT_DIR}/wasm-apps/${OUT_FILE} ${APP_SRC}
-
-
-if [ -f ${OUT_DIR}/wasm-apps/${OUT_FILE} ]; then
- echo "build ${OUT_FILE} success"
-else
- echo "build ${OUT_FILE} fail"
-fi
-done
-echo "####################build wasm apps done"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh
deleted file mode 100755
index a5fb29166..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-out/basic -f out/wasm-apps/testapp.wasm \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c
deleted file mode 100644
index c35da3179..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c
+++ /dev/null
@@ -1,217 +0,0 @@
-
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_export.h"
-#include "bh_read_file.h"
-#include "bh_getopt.h"
-
-int
-intToStr(int x, char *str, int str_len, int digit);
-int
-get_pow(int x, int y);
-int32_t
-calculate_native(int32_t n, int32_t func1, int32_t func2);
-
-void
-print_usage(void)
-{
- fprintf(stdout, "Options:\r\n");
- fprintf(stdout, " -f [path of wasm file] \n");
-}
-
-int
-main(int argc, char *argv_main[])
-{
- static char global_heap_buf[512 * 1024];
- char *buffer, error_buf[128];
- int opt;
- char *wasm_path = NULL;
-
- wasm_module_t module = NULL;
- wasm_module_inst_t module_inst = NULL;
- wasm_exec_env_t exec_env = NULL;
- uint32 buf_size, stack_size = 8092, heap_size = 8092;
- wasm_function_inst_t func = NULL;
- wasm_function_inst_t func2 = NULL;
- char *native_buffer = NULL;
- uint32_t wasm_buffer = 0;
-
- RuntimeInitArgs init_args;
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- while ((opt = getopt(argc, argv_main, "hf:")) != -1) {
- switch (opt) {
- case 'f':
- wasm_path = optarg;
- break;
- case 'h':
- print_usage();
- return 0;
- case '?':
- print_usage();
- return 0;
- }
- }
- if (optind == 1) {
- print_usage();
- return 0;
- }
-
- // Define an array of NativeSymbol for the APIs to be exported.
- // Note: the array must be static defined since runtime
- // will keep it after registration
- // For the function signature specifications, goto the link:
- // https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md
-
- static NativeSymbol native_symbols[] = {
- {
- "intToStr", // the name of WASM function name
- intToStr, // the native function pointer
- "(i*~i)i", // the function prototype signature, avoid to use i32
- NULL // attachment is NULL
- },
- {
- "get_pow", // the name of WASM function name
- get_pow, // the native function pointer
- "(ii)i", // the function prototype signature, avoid to use i32
- NULL // attachment is NULL
- },
- { "calculate_native", calculate_native, "(iii)i", NULL }
- };
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- // Native symbols need below registration phase
- init_args.n_native_symbols = sizeof(native_symbols) / sizeof(NativeSymbol);
- init_args.native_module_name = "env";
- init_args.native_symbols = native_symbols;
-
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- buffer = bh_read_file_to_buffer(wasm_path, &buf_size);
-
- if (!buffer) {
- printf("Open wasm app file [%s] failed.\n", wasm_path);
- goto fail;
- }
-
- module = wasm_runtime_load(buffer, buf_size, error_buf, sizeof(error_buf));
- if (!module) {
- printf("Load wasm module failed. error: %s\n", error_buf);
- goto fail;
- }
-
- module_inst = wasm_runtime_instantiate(module, stack_size, heap_size,
- error_buf, sizeof(error_buf));
-
- if (!module_inst) {
- printf("Instantiate wasm module failed. error: %s\n", error_buf);
- goto fail;
- }
-
- exec_env = wasm_runtime_create_exec_env(module_inst, stack_size);
- if (!exec_env) {
- printf("Create wasm execution environment failed.\n");
- goto fail;
- }
-
- if (!(func = wasm_runtime_lookup_function(module_inst, "generate_float",
- NULL))) {
- printf("The generate_float wasm function is not found.\n");
- goto fail;
- }
-
- wasm_val_t results[1] = { { .kind = WASM_F32, .of.f32 = 0 } };
- wasm_val_t arguments[3] = {
- { .kind = WASM_I32, .of.i32 = 10 },
- { .kind = WASM_F64, .of.f64 = 0.000101 },
- { .kind = WASM_F32, .of.f32 = 300.002 },
- };
-
- // pass 4 elements for function arguments
- if (!wasm_runtime_call_wasm_a(exec_env, func, 1, results, 3, arguments)) {
- printf("call wasm function generate_float failed. %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
- float ret_val;
- ret_val = results[0].of.f32;
- printf("Native finished calling wasm function generate_float(), returned a "
- "float value: %ff\n",
- ret_val);
-
- // Next we will pass a buffer to the WASM function
- uint32 argv2[4];
-
- // must allocate buffer from wasm instance memory space (never use pointer
- // from host runtime)
- wasm_buffer =
- wasm_runtime_module_malloc(module_inst, 100, (void **)&native_buffer);
-
- memcpy(argv2, &ret_val, sizeof(float)); // the first argument
- argv2[1] = wasm_buffer; // the second argument is the wasm buffer address
- argv2[2] = 100; // the third argument is the wasm buffer size
- argv2[3] = 3; // the last argument is the digits after decimal point for
- // converting float to string
-
- if (!(func2 = wasm_runtime_lookup_function(module_inst, "float_to_string",
- NULL))) {
- printf(
- "The wasm function float_to_string wasm function is not found.\n");
- goto fail;
- }
-
- if (wasm_runtime_call_wasm(exec_env, func2, 4, argv2)) {
- printf("Native finished calling wasm function: float_to_string, "
- "returned a formatted string: %s\n",
- native_buffer);
- }
- else {
- printf("call wasm function float_to_string failed. error: %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
- wasm_function_inst_t func3 =
- wasm_runtime_lookup_function(module_inst, "calculate", NULL);
- if (!func3) {
- printf("The wasm function calculate is not found.\n");
- goto fail;
- }
-
- uint32_t argv3[1] = { 3 };
- if (wasm_runtime_call_wasm(exec_env, func3, 1, argv3)) {
- uint32_t result = *(uint32_t *)argv3;
- printf("Native finished calling wasm function: calculate, return: %d\n",
- result);
- }
- else {
- printf("call wasm function calculate failed. error: %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
-fail:
- if (exec_env)
- wasm_runtime_destroy_exec_env(exec_env);
- if (module_inst) {
- if (wasm_buffer)
- wasm_runtime_module_free(module_inst, wasm_buffer);
- wasm_runtime_deinstantiate(module_inst);
- }
- if (module)
- wasm_runtime_unload(module);
- if (buffer)
- BH_FREE(buffer);
- wasm_runtime_destroy();
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c
deleted file mode 100644
index 1374c8dd8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "bh_platform.h"
-#include "wasm_export.h"
-#include "math.h"
-
-// The first parameter is not exec_env because it is invoked by native funtions
-void
-reverse(char *str, int len)
-{
- int i = 0, j = len - 1, temp;
- while (i < j) {
- temp = str[i];
- str[i] = str[j];
- str[j] = temp;
- i++;
- j--;
- }
-}
-
-// The first parameter exec_env must be defined using type wasm_exec_env_t
-// which is the calling convention for exporting native API by WAMR.
-//
-// Converts a given integer x to string str[].
-// digit is the number of digits required in the output.
-// If digit is more than the number of digits in x,
-// then 0s are added at the beginning.
-int
-intToStr(wasm_exec_env_t exec_env, int x, char *str, int str_len, int digit)
-{
- int i = 0;
-
- printf("calling into native function: %s\n", __FUNCTION__);
-
- while (x) {
- // native is responsible for checking the str_len overflow
- if (i >= str_len) {
- return -1;
- }
- str[i++] = (x % 10) + '0';
- x = x / 10;
- }
-
- // If number of digits required is more, then
- // add 0s at the beginning
- while (i < digit) {
- if (i >= str_len) {
- return -1;
- }
- str[i++] = '0';
- }
-
- reverse(str, i);
-
- if (i >= str_len)
- return -1;
- str[i] = '\0';
- return i;
-}
-
-int
-get_pow(wasm_exec_env_t exec_env, int x, int y)
-{
- printf("calling into native function: %s\n", __FUNCTION__);
- return (int)pow(x, y);
-}
-
-int32_t
-calculate_native(wasm_exec_env_t exec_env, int32_t n, int32_t func1,
- int32_t func2)
-{
- printf("calling into native function: %s, n=%d, func1=%d, func2=%d\n",
- __FUNCTION__, n, func1, func2);
-
- uint32_t argv[] = { n };
- if (!wasm_runtime_call_indirect(exec_env, func1, 1, argv)) {
- printf("call func1 failed\n");
- return 0xDEAD;
- }
-
- uint32_t n1 = argv[0];
- printf("call func1 and return n1=%d\n", n1);
-
- if (!wasm_runtime_call_indirect(exec_env, func2, 1, argv)) {
- printf("call func2 failed\n");
- return 0xDEAD;
- }
-
- uint32_t n2 = argv[0];
- printf("call func2 and return n2=%d\n", n2);
- return n1 + n2;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c
deleted file mode 100644
index ea575e20c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-int
-intToStr(int x, char *str, int str_len, int digit);
-int
-get_pow(int x, int y);
-int32_t
-calculate_native(int32_t n, int32_t func1, int32_t func2);
-
-//
-// Primitive parameters functions
-//
-float
-generate_float(int iteration, double seed1, float seed2)
-{
- float ret;
-
- printf("calling into WASM function: %s\n", __FUNCTION__);
-
- for (int i = 0; i < iteration; i++) {
- ret += 1.0f / seed1 + seed2;
- }
-
- return ret;
-}
-
-// Converts a floating-point/double number to a string.
-// intToStr() is implemented outside wasm app
-void
-float_to_string(float n, char *res, int res_size, int afterpoint)
-{
-
- printf("calling into WASM function: %s\n", __FUNCTION__);
-
- // Extract integer part
- int ipart = (int)n;
-
- // Extract floating part
- float fpart = n - (float)ipart;
-
- // convert integer part to string
- int i = intToStr(ipart, res, res_size, 0);
-
- // check for display option after point
- if (afterpoint != 0) {
- res[i] = '.'; // add dot
-
- // Get the value of fraction part upto given no.
- // of points after dot. The third parameter
- // is needed to handle cases like 233.007
- fpart = fpart * get_pow(10, afterpoint);
-
- intToStr((int)fpart, res + i + 1, sizeof(res + i + 1), afterpoint);
- }
-}
-
-int32_t
-mul7(int32_t n)
-{
- printf("calling into WASM function: %s,", __FUNCTION__);
- n = n * 7;
- printf(" %s return %d \n", __FUNCTION__, n);
- return n;
-}
-
-int32_t
-mul5(int32_t n)
-{
- printf("calling into WASM function: %s,", __FUNCTION__);
- n = n * 5;
- printf(" %s return %d \n", __FUNCTION__, n);
- return n;
-}
-
-int32_t
-calculate(int32_t n)
-{
- printf("calling into WASM function: %s\n", __FUNCTION__);
- int32_t (*f1)(int32_t) = &mul5;
- int32_t (*f2)(int32_t) = &mul7;
- return calculate_native(n, (uint32_t)f1, (uint32_t)f2);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/CMakeLists.txt
deleted file mode 100644
index c3a69ccc8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (C) 2022 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.0)
-project(file)
-
-################ wasm application ###############
-add_subdirectory(src)
-add_subdirectory(wasm-app)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/README.md
deleted file mode 100644
index 8b34719ef..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/README.md
+++ /dev/null
@@ -1,112 +0,0 @@
-# "file" sample introduction
-
-This sample demonstrates the supported file interaction API of WASI.
-This sample can also demonstrate the SGX IPFS (Intel Protected File System), enabling an enclave to seal and unseal data at rest.
-
-## Preparation
-
-Please install WASI SDK, download the [wasi-sdk release](https://github.com/CraneStation/wasi-sdk/releases) and extract the archive to default path `/opt/wasi-sdk`.
-For testing with SGX IPFS, follow the instructions in [the documentation of SGX for WAMR](../../doc/linux_sgx.md#sgx-intel-protected-file-system).
-
-## Build the sample
-
-```bash
-mkdir build
-cd build
-cmake ..
-make
-```
-
-The WebAssembly application is the file located at `wasm-app/file.wasm`.
-
-## Run workload
-
-Either use [iwasm-sample](../../product-mini/platforms/linux/) for Linux, or [enclave-sample](../../product-mini/platforms/linux-sgx/enclave-sample/) for Intel SGX to run the sample, with the argument to allow the file system interaction with the current folder (`--dir=.`).
-
-The output with Linux and POSIX is like:
-
-```bash
-Opening a file..
-[Test] File opening passed.
-Writing to the file..
-[Test] File writing passed.
-Moving the cursor to the start of the file..
-Reading from the file, up to 1000 characters..
-Text read: Hello, world!
-[Test] File reading passed.
-Determine whether we reach the end of the file..
-Is the end of file? 1
-[Test] End of file detection passed.
-Getting the plaintext size..
-The plaintext size is 13.
-[Test] Retrieving file offset passed.
-Force actual write of all the cached data to the disk..
-[Test] Retrieving file offset passed.
-Writing 5 characters at offset 7..
-File current offset: 13
-[Test] Writing at specified offset passed.
-Reading 5 characters at offset 7..
-Text read: James
-File current offset: 13
-[Test] Reading at specified offset passed.
-Allocate more space to the file..
-File current offset: 13
-Moving to the end..
-File current offset: 23
-[Test] Allocation or more space passed.
-Extend the file size of 10 bytes using ftruncate..
-File current offset: 23
-Moving to the end..
-File current offset: 33
-[Test] Extension of the file size passed.
-Closing from the file..
-[Test] Closing file passed.
-Getting the size of the file on disk..
-The file size is 33.
-All the tests passed!
-```
-
-The output with SGX and IPFS is like:
-
-```bash
-Opening a file..
-[Test] File opening passed.
-Writing to the file..
-[Test] File writing passed.
-Moving the cursor to the start of the file..
-Reading from the file, up to 1000 characters..
-Text read: Hello, world!
-[Test] File reading passed.
-Determine whether we reach the end of the file..
-Is the end of file? 1
-[Test] End of file detection passed.
-Getting the plaintext size..
-The plaintext size is 13.
-[Test] Retrieving file offset passed.
-Force actual write of all the cached data to the disk..
-[Test] Retrieving file offset passed.
-Writing 5 characters at offset 7..
-File current offset: 13
-[Test] Writing at specified offset passed.
-Reading 5 characters at offset 7..
-Text read: James
-File current offset: 13
-[Test] Reading at specified offset passed.
-Allocate more space to the file..
-File current offset: 23
-Moving to the end..
-File current offset: 23
-[Test] Allocation or more space passed.
-Extend the file size of 10 bytes using ftruncate..
-File current offset: 23
-Moving to the end..
-File current offset: 33
-[Test] Extension of the file size passed.
-Closing from the file..
-[Test] Closing file passed.
-Getting the size of the file on disk..
-The file size is 4096.
-All the tests passed!
-```
-
-For SGX IPFS, refer to [SGX Intel Protected File System](../../doc/linux_sgx.md#sgx-intel-protected-file-system) for more details.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/CMakeLists.txt
deleted file mode 100644
index 2bc3bec64..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (C) 2022 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-include(CheckPIESupported)
-
-if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
- project (iwasm)
-else()
- project (iwasm C ASM)
- enable_language (ASM_MASM)
-endif()
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-
-if (NOT MSVC)
- set (WAMR_BUILD_LIBC_WASI 1)
-endif ()
-
-if (NOT MSVC)
- # linker flags
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
- endif ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
- if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
- endif ()
- endif ()
-endif ()
-
-# build out vmlib
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-
-################ application related ################
-include_directories(${CMAKE_CURRENT_LIST_DIR})
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})
-
-check_pie_supported()
-set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-if (APPLE)
- target_link_libraries (iwasm vmlib -lm -ldl -lpthread)
-else ()
- target_link_libraries (iwasm vmlib -lm -ldl -lpthread -lrt)
-endif ()
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/main.c
deleted file mode 100644
index 3675ee057..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/src/main.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2022 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_export.h"
-#include "bh_read_file.h"
-
-void
-print_usage(void)
-{
- fprintf(stdout, "Required arguments:\r\n");
- fprintf(stdout, " -f [path of wasm file] \n");
- fprintf(stdout, " -d [path of host directory] \n");
-}
-
-int
-main(int argc, char *argv_main[])
-{
- static char global_heap_buf[512 * 1024];
- char *buffer, error_buf[128];
- const char *wasm_path = NULL, *wasi_dir = NULL;
- int opt, main_result = 1;
-
- wasm_module_t module = NULL;
- wasm_module_inst_t module_inst = NULL;
- wasm_exec_env_t exec_env = NULL;
- uint32 buf_size, stack_size = 8092, heap_size = 8092;
-
- RuntimeInitArgs init_args;
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- while ((opt = getopt(argc, argv_main, "hf:d:")) != -1) {
- switch (opt) {
- case 'f':
- wasm_path = optarg;
- break;
- case 'd':
- wasi_dir = optarg;
- break;
- case 'h':
- print_usage();
- return 0;
- case '?':
- print_usage();
- return 0;
- }
- }
- if (wasm_path == NULL || wasi_dir == NULL) {
- print_usage();
- return 0;
- }
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- buffer = bh_read_file_to_buffer(wasm_path, &buf_size);
-
- if (!buffer) {
- printf("Open wasm app file [%s] failed.\n", wasm_path);
- goto fail;
- }
-
- module = wasm_runtime_load(buffer, buf_size, error_buf, sizeof(error_buf));
- if (!module) {
- printf("Load wasm module failed. error: %s\n", error_buf);
- goto fail;
- }
-
- wasm_runtime_set_wasi_args_ex(module, &wasi_dir, 1, NULL, 0, NULL, 0, NULL,
- 0, 0, 1, 2);
-
- module_inst = wasm_runtime_instantiate(module, stack_size, heap_size,
- error_buf, sizeof(error_buf));
-
- if (!module_inst) {
- printf("Instantiate wasm module failed. error: %s\n", error_buf);
- goto fail;
- }
-
- exec_env = wasm_runtime_create_exec_env(module_inst, stack_size);
- if (!exec_env) {
- printf("Create wasm execution environment failed.\n");
- goto fail;
- }
-
- if (wasm_application_execute_main(module_inst, 0, NULL)) {
- main_result = wasm_runtime_get_wasi_exit_code(module_inst);
- }
- else {
- printf("call wasm function main failed. error: %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
-fail:
- if (exec_env)
- wasm_runtime_destroy_exec_env(exec_env);
- if (module_inst)
- wasm_runtime_deinstantiate(module_inst);
- if (module)
- wasm_runtime_unload(module);
- if (buffer)
- BH_FREE(buffer);
- wasm_runtime_destroy();
- return main_result;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/CMakeLists.txt
deleted file mode 100644
index 4af87a3fd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2022 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.0)
-project(wasm-app)
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
-
-if (APPLE)
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
- set (CMAKE_C_LINK_FLAGS "")
- set (CMAKE_CXX_LINK_FLAGS "")
-endif ()
-
-set (CMAKE_SYSTEM_PROCESSOR wasm32)
-
-if (NOT DEFINED WASI_SDK_DIR)
- set (WASI_SDK_DIR "/opt/wasi-sdk")
-endif ()
-
-set (CMAKE_C_COMPILER_TARGET "wasm32-wasi")
-set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument")
-
-add_executable(file.wasm main.c)
-target_link_libraries(file.wasm)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/main.c
deleted file mode 100644
index 6e6204cca..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/file/wasm-app/main.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#define PATH_TEST_FOLDER "./test"
-#define PATH_TEST_FILE (PATH_TEST_FOLDER "/test.txt")
-#define FILE_TEXT "Hello, world!"
-#define WORLD_OFFSET 7
-#define NAME_REPLACMENT "James"
-#define NAME_REPLACMENT_LEN (sizeof(NAME_REPLACMENT) - 1)
-#define ADDITIONAL_SPACE 1 * 1024 * 1024
-
-int
-main(int argc, char **argv)
-{
- FILE *file;
- const char *text = FILE_TEXT;
- char buffer[1000];
- int ret;
- long long stat_size;
-
- // Test: Create a folder to store the file, if it does not exist yet
- ret = mkdir(PATH_TEST_FOLDER, 777);
- assert(ret == 0 || (ret == -1 && errno == EEXIST));
-
- // Test: File opening (fopen)
- printf("Opening a file..\n");
- file = fopen(PATH_TEST_FILE, "w+");
- if (file == NULL) {
- printf("Error! errno: %d\n", errno);
- }
- assert(file != NULL);
- printf("[Test] File opening passed.\n");
-
- // Test: Writing to a file (fprintf)
- printf("Writing to the file..\n");
- ret = fprintf(file, "%s", text);
- assert(ret == strlen(text));
- printf("[Test] File writing passed.\n");
-
- // Test: Reading from a file (fseek)
- printf("Moving the cursor to the start of the file..\n");
- ret = fseek(file, 0, SEEK_SET);
- assert(ret == 0);
-
- printf("Reading from the file, up to 1000 characters..\n");
- fread(buffer, 1, sizeof(buffer), file);
- printf("Text read: %s\n", buffer);
- assert(strncmp(text, buffer, strlen(text)) == 0);
- printf("[Test] File reading passed.\n");
-
- // Test: end of file detection (feof)
- printf("Determine whether we reach the end of the file..\n");
- int is_end_of_file = feof(file);
- printf("Is the end of file? %d\n", is_end_of_file);
- assert(is_end_of_file == 1);
- printf("[Test] End of file detection passed.\n");
-
- // Test: retrieving file offset (ftell)
- printf("Getting the plaintext size..\n");
- long plaintext_size = ftell(file);
- printf("The plaintext size is %ld.\n", plaintext_size);
- assert(plaintext_size == 13);
- printf("[Test] Retrieving file offset passed.\n");
-
- // Test: persist changes on disk (fflush)
- printf("Force actual write of all the cached data to the disk..\n");
- ret = fflush(file);
- assert(ret == 0);
- printf("[Test] Retrieving file offset passed.\n");
-
- // Test: writing at specified offset (pwrite)
- printf("Writing 5 characters at offset %d..\n", WORLD_OFFSET);
- ret = pwrite(fileno(file), NAME_REPLACMENT, NAME_REPLACMENT_LEN,
- WORLD_OFFSET);
- printf("File current offset: %ld\n", ftell(file));
- assert(ret == NAME_REPLACMENT_LEN);
- assert(ftell(file) == strlen(FILE_TEXT));
- printf("[Test] Writing at specified offset passed.\n");
-
- // Test: reading at specified offset (pread)
- printf("Reading %ld characters at offset %d..\n", NAME_REPLACMENT_LEN,
- WORLD_OFFSET);
- buffer[NAME_REPLACMENT_LEN] = '\0';
- pread(fileno(file), buffer, NAME_REPLACMENT_LEN, WORLD_OFFSET);
- printf("Text read: %s\n", buffer);
- printf("File current offset: %ld\n", ftell(file));
- assert(strcmp(NAME_REPLACMENT, buffer) == 0);
- assert(ftell(file) == strlen(FILE_TEXT));
- printf("[Test] Reading at specified offset passed.\n");
-
- // Test: moving at the start of the file (fseek)
- printf("Move at the start of the file (fseek)..\n");
- printf("File current offset: %ld\n", ftell(file));
- fseek(file, 0, SEEK_SET);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == 0);
-
- // Test: moving at the end of the file (fseek)
- printf("Move at the end of the file (fseek)..\n");
- printf("File current offset: %ld\n", ftell(file));
- fseek(file, 0, SEEK_END);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == strlen(FILE_TEXT));
- int end_position = ftell(file) / 2;
-
- // Test: moving at the middle of the file (fseek)
- printf("Move at the middle of the file (fseek)..\n");
- printf("File current offset: %ld\n", ftell(file));
- fseek(file, 0, SEEK_SET);
- fseek(file, end_position, SEEK_CUR);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == end_position);
-
- // Test: allocate more space to the file (posix_fallocate)
- printf("Allocate more space to the file (posix_fallocate)..\n");
- fseek(file, 0, SEEK_END);
- posix_fallocate(fileno(file), ftell(file), ADDITIONAL_SPACE);
- printf("File current offset: %ld\n", ftell(file));
- printf("Moving to the end..\n");
- fseek(file, 0, SEEK_END);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == strlen(text) + ADDITIONAL_SPACE);
- printf("[Test] Allocation or more space passed.\n");
-
- // Test: allocate more space to the file (ftruncate)
- printf("Allocate more space to the file (ftruncate)..\n");
- ftruncate(fileno(file), ftell(file) + ADDITIONAL_SPACE);
- assert(ftell(file) == strlen(text) + ADDITIONAL_SPACE);
- printf("File current offset: %ld\n", ftell(file));
- printf("Moving to the end..\n");
- fseek(file, 0, SEEK_END);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == strlen(text) + 2 * ADDITIONAL_SPACE);
- printf("[Test] Extension of the file size passed.\n");
-
- // Test: allocate more space to the file (fseek, from the start)
- printf("Allocate more space to the file (fseek) from the start..\n");
- printf("File current offset: %ld\n", ftell(file));
- fseek(file, 3 * ADDITIONAL_SPACE, SEEK_SET);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == 3 * ADDITIONAL_SPACE);
- printf("[Test] Extension of the file size passed.\n");
-
- // Test: allocate more space to the file (fseek, from the middle)
- printf("Allocate more space to the file (fseek) from the middle..\n");
- fseek(file, 3 * ADDITIONAL_SPACE, SEEK_SET);
- printf("File current offset: %ld\n", ftell(file));
- fseek(file, 2 * ADDITIONAL_SPACE, SEEK_CUR);
- printf("File current offset: %ld\n", ftell(file));
- assert(ftell(file) == 5 * ADDITIONAL_SPACE);
- printf("[Test] Extension of the file size passed.\n");
-
- // Display some debug information
- printf("Getting the size of the file on disk..\n");
- struct stat st;
- stat(PATH_TEST_FILE, &st);
- stat_size = st.st_size;
- assert(stat_size != 0);
-
- // Compare with the size from fstat
- fstat(fileno(file), &st);
- printf("The file size is: %lld (stat), %lld (fstat).\n", stat_size,
- st.st_size);
- assert(stat_size != 0);
- assert(stat_size == st.st_size);
-
- // Test: closing the file (fclose)
- printf("Closing from the file..\n");
- ret = fclose(file);
- assert(ret == 0);
- printf("[Test] Closing file passed.\n");
-
- printf("All the tests passed!\n");
-
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/README.md
deleted file mode 100644
index d79453c3e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/README.md
+++ /dev/null
@@ -1,138 +0,0 @@
-"gui" sample introduction
-==============
-This sample demonstrates that a graphic user interface application in WebAssembly programming with WAMR graphic library(WGL) which is part of WAMR app-framework.
-
-Compared with the [littlevgl](../littlevgl) sample, WGL compiles LittlevGL source code into the WAMR runtime and defines a set of wrapper API's for exporting to Webassembly application.
-
-Below picture shows the WASM application is running on an STM board with an LCD touch panel.
-
-![WAMR UI SAMPLE](../../doc/pics/vgl_demo2.png "WAMR UI DEMO")
-
- When user clicks the blue button, the WASM application increases the counter, and the latest counter value is displayed on the top banner of the touch panel. The number on top will plus one each second, and the number on the bottom will plus one when clicked.
-
-# Test on Linux
-
-Install required SDK and libraries
---------------
-- 32 bit SDL(simple directmedia layer) (Note: only necessary when `WAMR_BUILD_TARGET` is set to `X86_32` when building WAMR runtime)
-Use apt-get:
- ```bash
- sudo apt-get install libsdl2-dev:i386
- ```
-Or download source from www.libsdl.org:
- ```bash
- ./configure C_FLAGS=-m32 CXX_FLAGS=-m32 LD_FLAGS=-m32
- make
- sudo make install
- ```
-- 64 bit SDL(simple directmedia layer) (Note: only necessary when `WAMR_BUILD_TARGET` is set to `X86_64` when building WAMR runtime)
-Use apt-get:
-
- ```bash
- sudo apt-get install libsdl2-dev
- ```
- Or download source from www.libsdl.org:
- ```bash
- ./configure
- make
- sudo make install
- ```
-
-Build and Run
---------------
-
-- Build
- ```bash
- ./build.sh
- ```
- All binaries are in "out", which contains "host_tool", "ui_decrease.wasm", "ui_increase.wasm" and "wasm_runtime_wgl".
-
-- Run WASM VM Linux applicaton & install WASM APP
- First start wasm_runtime_wgl in server mode.
- ```bash
- ./wasm_runtime_wgl -s
- ```
- Then install wasm APP by using host tool.
- ```bash
- ./host_tool -i inc -f ui_increase.wasm
- # or
- ./host_tool -i dec -f ui_decrease.wasm
- ```
-
-Test on Zephyr
-================================
-
-We can use a STM32 NUCLEO_F767ZI board with ILI9341 display and XPT2046 touch screen to run the test. Then use host_tool to remotely install wasm app into STM32.
-- Build WASM VM into Zephyr system
- a. clone zephyr source code
-Refer to [Zephyr getting started](https://docs.zephyrproject.org/latest/getting_started/index.html).
-
- ```bash
- west init zephyrproject
- cd zephyrproject/zephyr
- git checkout zephyr-v2.3.0
- cd ..
- west update
- ```
- b. copy samples
- ```bash
- cd zephyr/samples
- cp -a <wamr_root>/samples/gui/wasm-runtime-wgl wasm-runtime-wgl
- cd wasm-runtime-wgl/zephyr_build
- ```
- c. create a link to wamr root dir
- ```bash
- ln -s <wamr_root> wamr
- ```
- d. build source code
- ```bash
- mkdir build && cd build
- source ../../../../zephyr-env.sh
- cmake -GNinja -DBOARD=nucleo_f767zi ..
- ninja flash
- ```
-
-- Hardware Connections
-
-```
-+-------------------+-+------------------+
-|NUCLEO-F767ZI | ILI9341 Display |
-+-------------------+-+------------------+
-| CN7.10 | CLK |
-+-------------------+-+------------------+
-| CN7.12 | MISO |
-+-------------------+-+------------------+
-| CN7.14 | MOSI |
-+-------------------+-+------------------+
-| CN11.1 | CS1 for ILI9341 |
-+-------------------+-+------------------+
-| CN11.2 | D/C |
-+-------------------+-+------------------+
-| CN11.3 | RESET |
-+-------------------+-+------------------+
-| CN9.25 | PEN interrupt |
-+-------------------+-+------------------+
-| CN9.27 | CS2 for XPT2046 |
-+-------------------+-+------------------+
-| CN10.14 | PC UART RX |
-+-------------------+-+------------------+
-| CN11.16 | PC UART RX |
-+-------------------+-+------------------+
-```
-
-- Install WASM application to Zephyr using host_tool
-First, connect PC and STM32 with UART. Then install to use host_tool.
- ```bash
- sudo ./host_tool -D /dev/ttyUSBXXX -i inc -f ui_increase.wasm
- # /dev/ttyUSBXXX is the UART device, e.g. /dev/ttyUSB0
- ```
-
-- Install AOT version WASM application
- ```bash
- wamrc --target=thumbv7 --target-abi=eabi --cpu=cortex-m7 -o ui_app.aot ui_increase.wasm
- ./host_tool -D /dev/ttyUSBXXX -i inc -f ui_app.aot
- ```
-
-The graphic user interface demo photo:
-
-![WAMR samples diagram](../../doc/pics/vgl_demo.png "WAMR samples diagram")
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/build.sh
deleted file mode 100755
index f910f450b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/build.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-PROJECT_DIR=$PWD
-WAMR_DIR=${PWD}/../..
-OUT_DIR=${PWD}/out
-BUILD_DIR=${PWD}/build
-WAMR_RUNTIME_CFG=${PROJECT_DIR}/wamr_config_gui.cmake
-LV_CFG_PATH=${PROJECT_DIR}/lv_config
-
-if [ -z $KW_BUILD ] || [ -z $KW_OUT_FILE ];then
- echo "Local Build Env"
- cmakewrap="cmake"
- makewrap="make"
-else
- echo "Klocwork Build Env"
- cmakewrap="cmake -DCMAKE_BUILD_TYPE=Debug"
- makewrap="kwinject -o $KW_OUT_FILE make"
-fi
-
-if [ ! -d $BUILD_DIR ]; then
- mkdir ${BUILD_DIR}
-fi
-
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-
-
-echo -e "\n\n"
-echo "##################### 1. build wamr-sdk gui start#####################"
-cd ${WAMR_DIR}/wamr-sdk
-./build_sdk.sh -n gui -x ${WAMR_RUNTIME_CFG} -e ${LV_CFG_PATH}
-[ $? -eq 0 ] || exit $?
-
-echo "#####################build wamr-sdk success"
-
-
-
-echo "##################### 2. build wasm runtime start#####################"
-cd $BUILD_DIR
-mkdir -p wasm-runtime-wgl
-cd wasm-runtime-wgl
-$cmakewrap ${PROJECT_DIR}/wasm-runtime-wgl/linux-build -DWAMR_BUILD_SDK_PROFILE=gui
-[ $? -eq 0 ] || exit $?
-$makewrap
-[ $? -eq 0 ] || exit $?
-cp wasm_runtime_wgl ${OUT_DIR}/
-
-echo "##################### build littlevgl wasm runtime end#####################"
-echo -e "\n\n"
-
-
-echo "#####################build host-tool"
-cd $BUILD_DIR
-mkdir -p host-tool
-cd host-tool
-$cmakewrap ${WAMR_DIR}/test-tools/host-tool
-$makewrap
-if [ $? != 0 ];then
- echo "BUILD_FAIL host tool exit as $?\n"
- exit 2
-fi
-cp host_tool ${OUT_DIR}
-echo "#####################build host-tool success"
-echo -e "\n\n"
-
-echo "##################### 3. build wasm ui app start#####################"
-cd ${PROJECT_DIR}/wasm-apps
-export OUT_DIR=${OUT_DIR}
-./build_apps.sh
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_conf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_conf.h
deleted file mode 100644
index 2f9fc77a7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_conf.h
+++ /dev/null
@@ -1,498 +0,0 @@
-/**
- * @file lv_conf.h
- *
- */
-
-/*
- * COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER
- */
-
-#if 1 /*Set it to "1" to enable content*/
-
-#ifndef LV_CONF_H
-#define LV_CONF_H
-/* clang-format off */
-
-#include <stdint.h>
-
-/*====================
- Graphical settings
- *====================*/
-
-/* Maximal horizontal and vertical resolution to support by the library.*/
-#define LV_HOR_RES_MAX (320)
-#define LV_VER_RES_MAX (240)
-
-/* Color depth:
- * - 1: 1 byte per pixel
- * - 8: RGB233
- * - 16: RGB565
- * - 32: ARGB8888
- */
-#define LV_COLOR_DEPTH 32
-
-/* Swap the 2 bytes of RGB565 color.
- * Useful if the display has a 8 bit interface (e.g. SPI)*/
-#define LV_COLOR_16_SWAP 0
-
-/* 1: Enable screen transparency.
- * Useful for OSD or other overlapping GUIs.
- * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
-#define LV_COLOR_SCREEN_TRANSP 0
-
-/*Images pixels with this color will not be drawn (with chroma keying)*/
-#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
-
-/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
-#define LV_ANTIALIAS 1
-
-/* Default display refresh period.
- * Can be changed in the display driver (`lv_disp_drv_t`).*/
-#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
-
-/* Dot Per Inch: used to initialize default sizes.
- * E.g. a button with width = LV_DPI / 2 -> half inch wide
- * (Not so important, you can adjust it to modify default sizes and spaces)*/
-#define LV_DPI 100 /*[px]*/
-
-/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
-typedef int16_t lv_coord_t;
-
-/*=========================
- Memory manager settings
- *=========================*/
-
-/* LittelvGL's internal memory manager's settings.
- * The graphical objects and other related data are stored here. */
-
-/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
-#ifndef LV_MEM_CUSTOM
-#define LV_MEM_CUSTOM 0
-#endif
-
-#if LV_MEM_CUSTOM == 0
-/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
-# define LV_MEM_SIZE (128U * 1024U)
-
-/* Complier prefix for a big array declaration */
-# define LV_MEM_ATTR
-
-/* Set an address for the memory pool instead of allocating it as an array.
- * Can be in external SRAM too. */
-# define LV_MEM_ADR 0
-
-/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
-# define LV_MEM_AUTO_DEFRAG 1
-#else /*LV_MEM_CUSTOM*/
-# define LV_MEM_CUSTOM_INCLUDE "bh_platform.h" /*Header for the dynamic memory function*/
-# define LV_MEM_CUSTOM_ALLOC BH_MALLOC /*Wrapper to malloc*/
-# define LV_MEM_CUSTOM_FREE BH_FREE /*Wrapper to free*/
-#endif /*LV_MEM_CUSTOM*/
-
-/* Garbage Collector settings
- * Used if lvgl is binded to higher level language and the memory is managed by that language */
-#define LV_ENABLE_GC 0
-#if LV_ENABLE_GC != 0
-# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
-# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
-# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
-#endif /* LV_ENABLE_GC */
-
-/*=======================
- Input device settings
- *=======================*/
-
-/* Input device default settings.
- * Can be changed in the Input device driver (`lv_indev_drv_t`)*/
-
-/* Input device read period in milliseconds */
-#define LV_INDEV_DEF_READ_PERIOD 30
-
-/* Drag threshold in pixels */
-#define LV_INDEV_DEF_DRAG_LIMIT 10
-
-/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
-#define LV_INDEV_DEF_DRAG_THROW 20
-
-/* Long press time in milliseconds.
- * Time to send `LV_EVENT_LONG_PRESSSED`) */
-#define LV_INDEV_DEF_LONG_PRESS_TIME 400
-
-/* Repeated trigger period in long press [ms]
- * Time between `LV_EVENT_LONG_PRESSED_REPEAT */
-#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
-
-/*==================
- * Feature usage
- *==================*/
-
-/*1: Enable the Animations */
-#define LV_USE_ANIMATION 1
-#if LV_USE_ANIMATION
-
-/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
-typedef void * lv_anim_user_data_t;
-
-#endif
-
-/* 1: Enable shadow drawing*/
-#define LV_USE_SHADOW 1
-
-/* 1: Enable object groups (for keyboard/encoder navigation) */
-#define LV_USE_GROUP 1
-#if LV_USE_GROUP
-typedef void * lv_group_user_data_t;
-#endif /*LV_USE_GROUP*/
-
-/* 1: Enable GPU interface*/
-#define LV_USE_GPU 1
-
-/* 1: Enable file system (might be required for images */
-#define LV_USE_FILESYSTEM 1
-#if LV_USE_FILESYSTEM
-/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
-typedef void * lv_fs_drv_user_data_t;
-#endif
-
-/*1: Add a `user_data` to drivers and objects*/
-#define LV_USE_USER_DATA 1
-
-/*========================
- * Image decoder and cache
- *========================*/
-
-/* 1: Enable indexed (palette) images */
-#define LV_IMG_CF_INDEXED 1
-
-/* 1: Enable alpha indexed images */
-#define LV_IMG_CF_ALPHA 1
-
-/* Default image cache size. Image caching keeps the images opened.
- * If only the built-in image formats are used there is no real advantage of caching.
- * (I.e. no new image decoder is added)
- * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
- * However the opened images might consume additional RAM.
- * LV_IMG_CACHE_DEF_SIZE must be >= 1 */
-#define LV_IMG_CACHE_DEF_SIZE 1
-
-/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
-typedef void * lv_img_decoder_user_data_t;
-
-/*=====================
- * Compiler settings
- *====================*/
-/* Define a custom attribute to `lv_tick_inc` function */
-#define LV_ATTRIBUTE_TICK_INC
-
-/* Define a custom attribute to `lv_task_handler` function */
-#define LV_ATTRIBUTE_TASK_HANDLER
-
-/* With size optimization (-Os) the compiler might not align data to
- * 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
- * E.g. __attribute__((aligned(4))) */
-#define LV_ATTRIBUTE_MEM_ALIGN
-
-/* Attribute to mark large constant arrays for example
- * font's bitmaps */
-#define LV_ATTRIBUTE_LARGE_CONST
-
-/*===================
- * HAL settings
- *==================*/
-
-/* 1: use a custom tick source.
- * It removes the need to manually update the tick with `lv_tick_inc`) */
-#define LV_TICK_CUSTOM 1
-#if LV_TICK_CUSTOM == 1
-#define LV_TICK_CUSTOM_INCLUDE "system_header.h" /*Header for the sys time function*/
-#define LV_TICK_CUSTOM_SYS_TIME_EXPR (time_get_ms()) /*Expression evaluating to current systime in ms*/
-#endif /*LV_TICK_CUSTOM*/
-
-typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
-typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
-
-/*================
- * Log settings
- *===============*/
-
-/*1: Enable the log module*/
-#define LV_USE_LOG 1
-#if LV_USE_LOG
-/* How important log should be added:
- * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
- * LV_LOG_LEVEL_INFO Log important events
- * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
- * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
- * LV_LOG_LEVEL_NONE Do not log anything
- */
-# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
-
-/* 1: Print the log with 'printf';
- * 0: user need to register a callback with `lv_log_register_print`*/
-# define LV_LOG_PRINTF 1
-#endif /*LV_USE_LOG*/
-
-/*================
- * THEME USAGE
- *================*/
-#define LV_THEME_LIVE_UPDATE 1 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/
-
-#define LV_USE_THEME_TEMPL 1 /*Just for test*/
-#define LV_USE_THEME_DEFAULT 1 /*Built mainly from the built-in styles. Consumes very few RAM*/
-#define LV_USE_THEME_ALIEN 1 /*Dark futuristic theme*/
-#define LV_USE_THEME_NIGHT 1 /*Dark elegant theme*/
-#define LV_USE_THEME_MONO 1 /*Mono color theme for monochrome displays*/
-#define LV_USE_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/
-#define LV_USE_THEME_ZEN 1 /*Peaceful, mainly light theme */
-#define LV_USE_THEME_NEMO 1 /*Water-like theme based on the movie "Finding Nemo"*/
-
-/*==================
- * FONT USAGE
- *===================*/
-
-/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
- * The symbols are available via `LV_SYMBOL_...` defines
- * More info about fonts: https://docs.littlevgl.com/#Fonts
- * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
- */
-
-/* Robot fonts with bpp = 4
- * https://fonts.google.com/specimen/Roboto */
-#define LV_FONT_ROBOTO_12 1
-#define LV_FONT_ROBOTO_16 1
-#define LV_FONT_ROBOTO_22 1
-#define LV_FONT_ROBOTO_28 1
-
-/*Pixel perfect monospace font
- * http://pelulamu.net/unscii/ */
-#define LV_FONT_UNSCII_8 1
-
-/* Optionally declare your custom fonts here.
- * You can use these fonts as default font too
- * and they will be available globally. E.g.
- * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
- * LV_FONT_DECLARE(my_font_2)
- */
-#define LV_FONT_CUSTOM_DECLARE
-
-/*Always set a default font from the built-in fonts*/
-#define LV_FONT_DEFAULT &lv_font_roboto_16
-
-/* Enable it if you have fonts with a lot of characters.
- * The limit depends on the font size, font face and bpp
- * but with > 10,000 characters if you see issues probably you need to enable it.*/
-#define LV_FONT_FMT_TXT_LARGE 1
-
-/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
-typedef void * lv_font_user_data_t;
-
-/*=================
- * Text settings
- *=================*/
-
-/* Select a character encoding for strings.
- * Your IDE or editor should have the same character encoding
- * - LV_TXT_ENC_UTF8
- * - LV_TXT_ENC_ASCII
- * */
-#define LV_TXT_ENC LV_TXT_ENC_UTF8
-
- /*Can break (wrap) texts on these chars*/
-#define LV_TXT_BREAK_CHARS " ,.;:-_"
-
-/*===================
- * LV_OBJ SETTINGS
- *==================*/
-
-/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
-typedef void * lv_obj_user_data_t;
-
-/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
-#define LV_USE_OBJ_REALIGN 1
-
-/* Enable to make the object clickable on a larger area.
- * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
- * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
- * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
- */
-#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_FULL
-
-/*==================
- * LV OBJ X USAGE
- *================*/
-/*
- * Documentation of the object types: https://docs.littlevgl.com/#Object-types
- */
-
-/*Arc (dependencies: -)*/
-#define LV_USE_ARC 1
-
-/*Bar (dependencies: -)*/
-#define LV_USE_BAR 1
-
-/*Button (dependencies: lv_cont*/
-#define LV_USE_BTN 1
-#if LV_USE_BTN != 0
-/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
-# define LV_BTN_INK_EFFECT 1
-#endif
-
-/*Button matrix (dependencies: -)*/
-#define LV_USE_BTNM 1
-
-/*Calendar (dependencies: -)*/
-#define LV_USE_CALENDAR 1
-
-/*Canvas (dependencies: lv_img)*/
-#define LV_USE_CANVAS 1
-
-/*Check box (dependencies: lv_btn, lv_label)*/
-#define LV_USE_CB 1
-
-/*Chart (dependencies: -)*/
-#define LV_USE_CHART 1
-#if LV_USE_CHART
-# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
-#endif
-
-/*Container (dependencies: -*/
-#define LV_USE_CONT 1
-
-/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
-#define LV_USE_DDLIST 1
-#if LV_USE_DDLIST != 0
-/*Open and close default animation time [ms] (0: no animation)*/
-# define LV_DDLIST_DEF_ANIM_TIME 200
-#endif
-
-/*Gauge (dependencies:lv_bar, lv_lmeter)*/
-#define LV_USE_GAUGE 1
-
-/*Image (dependencies: lv_label*/
-#define LV_USE_IMG 1
-
-/*Image Button (dependencies: lv_btn*/
-#define LV_USE_IMGBTN 1
-#if LV_USE_IMGBTN
-/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
-# define LV_IMGBTN_TILED 0
-#endif
-
-/*Keyboard (dependencies: lv_btnm)*/
-#define LV_USE_KB 1
-
-/*Label (dependencies: -*/
-#define LV_USE_LABEL 1
-#if LV_USE_LABEL != 0
-/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
-# define LV_LABEL_DEF_SCROLL_SPEED 25
-
-/* Waiting period at beginning/end of animation cycle */
-# define LV_LABEL_WAIT_CHAR_COUNT 3
-
-/*Enable selecting text of the label */
-# define LV_LABEL_TEXT_SEL 1
-
-/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
-# define LV_LABEL_LONG_TXT_HINT 0
-#endif
-
-/*LED (dependencies: -)*/
-#define LV_USE_LED 1
-
-/*Line (dependencies: -*/
-#define LV_USE_LINE 1
-
-/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
-#define LV_USE_LIST 1
-#if LV_USE_LIST != 0
-/*Default animation time of focusing to a list element [ms] (0: no animation) */
-# define LV_LIST_DEF_ANIM_TIME 100
-#endif
-
-/*Line meter (dependencies: *;)*/
-#define LV_USE_LMETER 1
-
-/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
-#define LV_USE_MBOX 1
-
-/*Page (dependencies: lv_cont)*/
-#define LV_USE_PAGE 1
-#if LV_USE_PAGE != 0
-/*Focus default animation time [ms] (0: no animation)*/
-# define LV_PAGE_DEF_ANIM_TIME 400
-#endif
-
-/*Preload (dependencies: lv_arc, lv_anim)*/
-#define LV_USE_PRELOAD 1
-#if LV_USE_PRELOAD != 0
-# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
-# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
-# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
-#endif
-
-/*Roller (dependencies: lv_ddlist)*/
-#define LV_USE_ROLLER 1
-#if LV_USE_ROLLER != 0
-/*Focus animation time [ms] (0: no animation)*/
-# define LV_ROLLER_DEF_ANIM_TIME 200
-
-/*Number of extra "pages" when the roller is infinite*/
-# define LV_ROLLER_INF_PAGES 7
-#endif
-
-/*Slider (dependencies: lv_bar)*/
-#define LV_USE_SLIDER 1
-
-/*Spinbox (dependencies: lv_ta)*/
-#define LV_USE_SPINBOX 1
-
-/*Switch (dependencies: lv_slider)*/
-#define LV_USE_SW 1
-
-/*Text area (dependencies: lv_label, lv_page)*/
-#define LV_USE_TA 1
-#if LV_USE_TA != 0
-# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
-# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/
-#endif
-
-/*Table (dependencies: lv_label)*/
-#define LV_USE_TABLE 1
-#if LV_USE_TABLE
-# define LV_TABLE_COL_MAX 12
-#endif
-
-/*Tab (dependencies: lv_page, lv_btnm)*/
-#define LV_USE_TABVIEW 1
-# if LV_USE_TABVIEW != 0
-/*Time of slide animation [ms] (0: no animation)*/
-# define LV_TABVIEW_DEF_ANIM_TIME 300
-#endif
-
-/*Tileview (dependencies: lv_page) */
-#define LV_USE_TILEVIEW 1
-#if LV_USE_TILEVIEW
-/*Time of slide animation [ms] (0: no animation)*/
-# define LV_TILEVIEW_DEF_ANIM_TIME 300
-#endif
-
-/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
-#define LV_USE_WIN 1
-
-/*==================
- * Non-user section
- *==================*/
-
-#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
-# define _CRT_SECURE_NO_WARNINGS
-#endif
-
-/*--END OF LV_CONF_H--*/
-
-/*Be sure every define has a default value*/
-#include "lvgl/src/lv_conf_checker.h"
-
-#endif /*LV_CONF_H*/
-
-#endif /*End of "Content enable"*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_drv_conf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_drv_conf.h
deleted file mode 100644
index d216a3e90..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/lv_drv_conf.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/**
- * @file lv_drv_conf.h
- *
- */
-
-/*
- * COPY THIS FILE AS lv_drv_conf.h
- */
-
-#if 1 /*Set it to "1" to enable the content*/
-
-#ifndef LV_DRV_CONF_H
-#define LV_DRV_CONF_H
-
-#include "lv_conf.h"
-
-/*********************
- * DELAY INTERFACE
- *********************/
-#define LV_DRV_DELAY_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_DELAY_US(us) /*delay_us(us)*/ /*Delay the given number of microseconds*/
-#define LV_DRV_DELAY_MS(ms) /*delay_ms(ms)*/ /*Delay the given number of milliseconds*/
-
-/*********************
- * DISPLAY INTERFACE
- *********************/
-
-/*------------
- * Common
- *------------*/
-#define LV_DRV_DISP_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_DISP_CMD_DATA(val) /*pin_x_set(val)*/ /*Set the command/data pin to 'val'*/
-#define LV_DRV_DISP_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
-
-/*---------
- * SPI
- *---------*/
-#define LV_DRV_DISP_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
-#define LV_DRV_DISP_SPI_WR_BYTE(data) /*spi_wr(data)*/ /*Write a byte the SPI bus*/
-#define LV_DRV_DISP_SPI_WR_ARRAY(adr, n) /*spi_wr_mem(adr, n)*/ /*Write 'n' bytes to SPI bus from 'adr'*/
-
-/*------------------
- * Parallel port
- *-----------------*/
-#define LV_DRV_DISP_PAR_CS(val) /*par_cs_set(val)*/ /*Set the Parallel port's Chip select to 'val'*/
-#define LV_DRV_DISP_PAR_SLOW /*par_slow()*/ /*Set low speed on the parallel port*/
-#define LV_DRV_DISP_PAR_FAST /*par_fast()*/ /*Set high speed on the parallel port*/
-#define LV_DRV_DISP_PAR_WR_WORD(data) /*par_wr(data)*/ /*Write a word to the parallel port*/
-#define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/
-
-/***************************
- * INPUT DEVICE INTERFACE
- ***************************/
-
-/*----------
- * Common
- *----------*/
-#define LV_DRV_INDEV_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_INDEV_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
-#define LV_DRV_INDEV_IRQ_READ 0 /*pn_x_read()*/ /*Read the IRQ pin*/
-
-/*---------
- * SPI
- *---------*/
-#define LV_DRV_INDEV_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
-#define LV_DRV_INDEV_SPI_XCHG_BYTE(data) 0 /*spi_xchg(val)*/ /*Write 'val' to SPI and give the read value*/
-
-/*---------
- * I2C
- *---------*/
-#define LV_DRV_INDEV_I2C_START /*i2c_start()*/ /*Make an I2C start*/
-#define LV_DRV_INDEV_I2C_STOP /*i2c_stop()*/ /*Make an I2C stop*/
-#define LV_DRV_INDEV_I2C_RESTART /*i2c_restart()*/ /*Make an I2C restart*/
-#define LV_DRV_INDEV_I2C_WR(data) /*i2c_wr(data)*/ /*Write a byte to the I1C bus*/
-#define LV_DRV_INDEV_I2C_READ(last_read) 0 /*i2c_rd()*/ /*Read a byte from the I2C bud*/
-
-
-/*********************
- * DISPLAY DRIVERS
- *********************/
-
-/*-------------------
- * Monitor of PC
- *-------------------*/
-#ifndef USE_MONITOR
-# define USE_MONITOR 1
-#endif
-
-#if USE_MONITOR
-# define MONITOR_HOR_RES LV_HOR_RES_MAX
-# define MONITOR_VER_RES LV_VER_RES_MAX
-
-/* Scale window by this factor (useful when simulating small screens) */
-# define MONITOR_ZOOM 1
-
-/* Used to test true double buffering with only address changing.
- * Set LV_VDB_SIZE = (LV_HOR_RES * LV_VER_RES) and LV_VDB_DOUBLE = 1 and LV_COLOR_DEPTH = 32" */
-# define MONITOR_DOUBLE_BUFFERED 0
-
-/*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
-# define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h>
-
-/*Different rendering might be used if running in a Virtual machine*/
-# define MONITOR_VIRTUAL_MACHINE 0
-
-/*Open two windows to test multi display support*/
-# define MONITOR_DUAL 0
-#endif
-
-/*-----------------------------------
- * Native Windows (including mouse)
- *----------------------------------*/
-#ifndef USE_WINDOWS
-# define USE_WINDOWS 0
-#endif
-
-#define USE_WINDOWS 0
-#if USE_WINDOWS
-# define WINDOW_HOR_RES 480
-# define WINDOW_VER_RES 320
-#endif
-
-/*----------------
- * SSD1963
- *--------------*/
-#ifndef USE_SSD1963
-# define USE_SSD1963 0
-#endif
-
-#if USE_SSD1963
-# define SSD1963_HOR_RES LV_HOR_RES
-# define SSD1963_VER_RES LV_VER_RES
-# define SSD1963_HT 531
-# define SSD1963_HPS 43
-# define SSD1963_LPS 8
-# define SSD1963_HPW 10
-# define SSD1963_VT 288
-# define SSD1963_VPS 12
-# define SSD1963_FPS 4
-# define SSD1963_VPW 10
-# define SSD1963_HS_NEG 0 /*Negative hsync*/
-# define SSD1963_VS_NEG 0 /*Negative vsync*/
-# define SSD1963_ORI 0 /*0, 90, 180, 270*/
-# define SSD1963_COLOR_DEPTH 16
-#endif
-
-/*----------------
- * R61581
- *--------------*/
-#ifndef USE_R61581
-# define USE_R61581 0
-#endif
-
-#if USE_R61581
-# define R61581_HOR_RES LV_HOR_RES
-# define R61581_VER_RES LV_VER_RES
-# define R61581_HSPL 0 /*HSYNC signal polarity*/
-# define R61581_HSL 10 /*HSYNC length (Not Implemented)*/
-# define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/
-# define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */
-# define R61581_VSPL 0 /*VSYNC signal polarity*/
-# define R61581_VSL 10 /*VSYNC length (Not Implemented)*/
-# define R61581_VFP 8 /*Vertical Front poarch*/
-# define R61581_VBP 8 /*Vertical Back poarch */
-# define R61581_DPL 0 /*DCLK signal polarity*/
-# define R61581_EPL 1 /*ENABLE signal polarity*/
-# define R61581_ORI 0 /*0, 180*/
-# define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/
-#endif
-
-/*------------------------------
- * ST7565 (Monochrome, low res.)
- *-----------------------------*/
-#ifndef USE_ST7565
-# define USE_ST7565 0
-#endif
-
-#if USE_ST7565
-/*No settings*/
-#endif /*USE_ST7565*/
-
-/*-----------------------------------------
- * Linux frame buffer device (/dev/fbx)
- *-----------------------------------------*/
-#ifndef USE_FBDEV
-# define USE_FBDEV 1
-#endif
-
-#if USE_FBDEV
-# define FBDEV_PATH "/dev/fb0"
-#endif
-
-/*********************
- * INPUT DEVICES
- *********************/
-
-/*--------------
- * XPT2046
- *--------------*/
-#ifndef USE_XPT2046
-# define USE_XPT2046 0
-#endif
-
-#if USE_XPT2046
-# define XPT2046_HOR_RES 480
-# define XPT2046_VER_RES 320
-# define XPT2046_X_MIN 200
-# define XPT2046_Y_MIN 200
-# define XPT2046_X_MAX 3800
-# define XPT2046_Y_MAX 3800
-# define XPT2046_AVG 4
-# define XPT2046_INV 0
-#endif
-
-/*-----------------
- * FT5406EE8
- *-----------------*/
-#ifndef USE_FT5406EE8
-# define USE_FT5406EE8 0
-#endif
-
-#if USE_FT5406EE8
-# define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/
-#endif
-
-/*---------------
- * AD TOUCH
- *--------------*/
-#ifndef USE_AD_TOUCH
-# define USE_AD_TOUCH 0
-#endif
-
-#if USE_AD_TOUCH
-/*No settings*/
-#endif
-
-
-/*---------------------------------------
- * Mouse or touchpad on PC (using SDL)
- *-------------------------------------*/
-#ifndef USE_MOUSE
-# define USE_MOUSE 1
-#endif
-
-#if USE_MOUSE
-/*No settings*/
-#endif
-
-/*-------------------------------------------
- * Mousewheel as encoder on PC (using SDL)
- *------------------------------------------*/
-#ifndef USE_MOUSEWHEEL
-# define USE_MOUSEWHEEL 1
-#endif
-
-#if USE_MOUSEWHEEL
-/*No settings*/
-#endif
-
-/*-------------------------------------------------
- * Touchscreen as libinput interface (for Linux based systems)
- *------------------------------------------------*/
-#ifndef USE_LIBINPUT
-# define USE_LIBINPUT 0
-#endif
-
-#if USE_LIBINPUT
-# define LIBINPUT_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
-#endif /*USE_LIBINPUT*/
-
-/*-------------------------------------------------
- * Mouse or touchpad as evdev interface (for Linux based systems)
- *------------------------------------------------*/
-#ifndef USE_EVDEV
-# define USE_EVDEV 0
-#endif
-
-#if USE_EVDEV
-# define EVDEV_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
-# define EVDEV_SWAP_AXES 0 /*Swap the x and y axes of the touchscreen*/
-
-# define EVDEV_SCALE 0 /* Scale input, e.g. if touchscreen resolution does not match display resolution */
-# if EVDEV_SCALE
-# define EVDEV_SCALE_HOR_RES (4096) /* Horizontal resolution of touchscreen */
-# define EVDEV_SCALE_VER_RES (4096) /* Vertical resolution of touchscreen */
-# endif /*EVDEV_SCALE*/
-
-# define EVDEV_CALIBRATE 0 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
-# if EVDEV_CALIBRATE
-# define EVDEV_HOR_MIN 3800 /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
-# define EVDEV_HOR_MAX 200
-# define EVDEV_VER_MIN 200
-# define EVDEV_VER_MAX 3800
-# endif /*EVDEV_SCALE*/
-#endif /*USE_EVDEV*/
-
-/*-------------------------------
- * Keyboard of a PC (using SDL)
- *------------------------------*/
-#ifndef USE_KEYBOARD
-# define USE_KEYBOARD 1
-#endif
-
-#if USE_KEYBOARD
-/*No settings*/
-#endif
-
-#endif /*LV_DRV_CONF_H*/
-
-#endif /*End of "Content enable"*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/system_header.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/system_header.h
deleted file mode 100644
index a0d790c8e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/lv_config/system_header.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-
-int
-time_get_ms();
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wamr_config_gui.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wamr_config_gui.cmake
deleted file mode 100644
index 3b33d33b2..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wamr_config_gui.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET "X86_64")
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_ALL)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/build_apps.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/build_apps.sh
deleted file mode 100755
index 18c76caf4..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/build_apps.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-
-APPS_ROOT=$(cd "$(dirname "$0")/" && pwd)
-cd ${APPS_ROOT}
-
-echo "OUT_DIR: ${OUT_DIR}"
-
-if [ -z ${OUT_DIR} ]; then
- OUT_DIR=${APPS_ROOT}/out
- echo "set the wasm app folder: ${OUT_DIR}"
-
- if [ -d ${OUT_DIR} ]; then
- rm -rf ${OUT_DIR}
- echo "removed the present output folder: ${OUT_DIR}"
- fi
- mkdir ${OUT_DIR}
-
-fi
-
-if [ -z ${WAMR_DIR} ]; then
- WAMR_DIR=${APPS_ROOT}/../../..
-fi
-
-
-cd ${APPS_ROOT}/increase
-
-rm -rf build
-mkdir build && cd build
-cmake .. -DCMAKE_TOOLCHAIN_FILE=${WAMR_DIR}/wamr-sdk/out/gui/app-sdk/wamr_toolchain.cmake \
- -DWASI_SDK_DIR=/opt/wasi-sdk
-make
-[ $? -eq 0 ] || exit $?
-mv ui_increase.wasm ${OUT_DIR}/
-
-# $makewrap
-# mv ui_app.wasm ${OUT_DIR}/
-
-cd ${APPS_ROOT}/decrease
-make
-[ $? -eq 0 ] || exit $?
-mv ui_decrease.wasm ${OUT_DIR}/
-
-echo "WASM files generated in folder ${OUT_DIR}"
-
-echo "##################### build WASM APPs finished #####################"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/Makefile b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/Makefile
deleted file mode 100644
index d99008beb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-CC = /opt/wasi-sdk/bin/clang
-APP_DIR = ${shell pwd}
-IWASM_DIR = $(APP_DIR)/../../../../core/iwasm
-SDK_DIR = $(APP_DIR)/../../../../wamr-sdk/out/gui/app-sdk
-APP_FRAMEWORK_DIR = $(APP_DIR)/../../../../wamr-sdk/out/gui/app-sdk/wamr-app-framework
-DEPS_DIR = $(APP_DIR)/../../../../core/deps
-
-CFLAGS += -O3 \
- -Wno-int-conversion \
- -I$(APP_DIR)/src \
- -I$(APP_FRAMEWORK_DIR)/include \
- -I${DEPS_DIR}
-
-SRCS += $(APP_DIR)/src/main.c
-
-all:
- @$(CC) $(CFLAGS) $(SRCS) \
- --target=wasm32 -O3 -z stack-size=2048 -Wl,--initial-memory=65536 \
- --sysroot=$(SDK_DIR)/libc-builtin-sysroot \
- -L$(APP_FRAMEWORK_DIR)/lib -lapp_framework \
- -Wl,--allow-undefined-file=$(SDK_DIR)/libc-builtin-sysroot/share/defined-symbols.txt \
- -Wl,--strip-all,--no-entry -nostdlib \
- -Wl,--export=on_init -Wl,--export=on_timer_callback \
- -Wl,--export=on_widget_event \
- -Wl,--export=__heap_base,--export=__data_end \
- -o ui_decrease.wasm
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/src/main.c
deleted file mode 100644
index a6c30aa1a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/decrease/src/main.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdlib.h>
-#include "wasm_app.h"
-#include "wa-inc/lvgl/lvgl.h"
-#include "wa-inc/timer_wasm_app.h"
-
-extern char g_widget_text[];
-
-static void
-btn_event_cb(lv_obj_t *btn, lv_event_t event);
-
-uint32_t count = 0;
-char count_str[11] = { 0 };
-lv_obj_t *hello_world_label;
-lv_obj_t *count_label;
-lv_obj_t *btn1;
-lv_obj_t *label_count1;
-int label_count1_value = 100;
-char label_count1_str[11] = { 0 };
-
-void
-timer1_update(user_timer_t timer1)
-{
- if ((count % 100) == 0) {
- snprintf(count_str, sizeof(count_str), "%d", count / 100);
- lv_label_set_text(count_label, count_str);
- }
- ++count;
-}
-
-void
-on_init()
-{
- char *text;
-
- hello_world_label = lv_label_create(NULL, NULL);
- lv_label_set_text(hello_world_label, "Hello world!");
- text = lv_label_get_text(hello_world_label);
- printf("Label text %lu %s \n", strlen(text), text);
- lv_obj_align(hello_world_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
-
- count_label = lv_label_create(NULL, NULL);
- lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
-
- btn1 = lv_btn_create(
- NULL, NULL); /*Create a button on the currently loaded screen*/
- lv_obj_set_event_cb(
- btn1,
- btn_event_cb); /*Set function to be called when the button is released*/
- lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0); /*Align below the label*/
-
- /*Create a label on the button*/
- lv_obj_t *btn_label = lv_label_create(btn1, NULL);
- lv_label_set_text(btn_label, "Click --");
-
- label_count1 = lv_label_create(NULL, NULL);
- lv_label_set_text(label_count1, "100");
- lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
-
- /* set up a timer */
- user_timer_t timer;
- timer = api_timer_create(10, true, false, timer1_update);
- if (timer)
- api_timer_restart(timer, 10);
- else
- printf("Fail to create timer.\n");
-}
-
-static void
-btn_event_cb(lv_obj_t *btn, lv_event_t event)
-{
- if (event == LV_EVENT_RELEASED) {
- label_count1_value--;
- snprintf(label_count1_str, sizeof(label_count1_str), "%d",
- label_count1_value);
- lv_label_set_text(label_count1, label_count1_str);
- if (label_count1_value == 0)
- label_count1_value = 100;
- }
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/CMakeLists.txt
deleted file mode 100644
index ce55fb1e6..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(wgl)
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../)
-
-include_directories(
- ${WAMR_ROOT_DIR}/wamr-sdk/out/gui/app-sdk/wamr-app-framework/include
- ${WAMR_ROOT_DIR}/core/deps
-)
-
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS},-L${WAMR_ROOT_DIR}/wamr-sdk/out/gui/app-sdk/wamr-app-framework/lib")
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS},--export=on_init,--export=on_timer_callback,--export=on_widget_event,--export=__heap_base,--export=__data_end")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument")
-
-add_executable(ui_increase.wasm
- ${CMAKE_CURRENT_LIST_DIR}/src/main.c
-)
-
-target_link_libraries(ui_increase.wasm app_framework)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/Makefile b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/Makefile
deleted file mode 100644
index 5f250d6ef..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-CC = /opt/wasi-sdk/bin/clang
-APP_DIR = ${shell pwd}
-IWASM_DIR = ../../../../core/iwasm
-APP_FRAMEWORK_DIR = ../../../../core/app-framework
-DEPS_DIR = ../../../../core/deps
-
-CFLAGS += -O3 \
- -Wno-int-conversion \
- -I$(APP_DIR)/src \
- -I$(APP_FRAMEWORK_DIR)/base/app \
- -I$(APP_FRAMEWORK_DIR)/app-native-shared \
- -I$(APP_FRAMEWORK_DIR)/sensor/app \
- -I$(APP_FRAMEWORK_DIR)/wgl/app \
- -I$(APP_FRAMEWORK_DIR)/connection/app \
- -I${DEPS_DIR}
-
-SRCS += $(APP_DIR)/src/main.c
-
-# For app size consideration, not all but necessary app libs are included
-SRCS += $(APP_FRAMEWORK_DIR)/base/app/timer.c
-SRCS += $(APP_FRAMEWORK_DIR)/wgl/app/src/*.c
-
-all:
- @$(CC) $(CFLAGS) $(SRCS) \
- --target=wasm32-wasi -O3 -z stack-size=2048 -Wl,--initial-memory=65536 \
- -nostdlib -Wl,--allow-undefined \
- -Wl,--strip-all,--no-entry \
- -Wl,--export=on_init -Wl,--export=on_timer_callback \
- -Wl,--export=on_widget_event \
- -Wl,--export=__heap_base,--export=__data_end \
- -o ui_app.wasm
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/src/main.c
deleted file mode 100644
index b5271830a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-apps/increase/src/main.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdlib.h>
-#include "wasm_app.h"
-#include "wa-inc/lvgl/lvgl.h"
-#include "wa-inc/timer_wasm_app.h"
-
-extern char g_widget_text[];
-
-static void
-btn_event_cb(lv_obj_t *btn, lv_event_t event);
-
-uint32_t count = 0;
-char count_str[11] = { 0 };
-lv_obj_t *hello_world_label;
-lv_obj_t *count_label;
-lv_obj_t *btn1;
-lv_obj_t *label_count1;
-int label_count1_value = 1;
-char label_count1_str[11] = { 0 };
-
-void
-timer1_update(user_timer_t timer1)
-{
- if ((count % 100) == 0) {
- snprintf(count_str, sizeof(count_str), "%d", count / 100);
- lv_label_set_text(count_label, count_str);
- }
- ++count;
-}
-
-void
-on_init()
-{
- char *text;
-
- hello_world_label = lv_label_create(NULL, NULL);
- lv_label_set_text(hello_world_label, "Hello world!");
- text = lv_label_get_text(hello_world_label);
- printf("Label text %lu %s \n", strlen(text), text);
- lv_obj_align(hello_world_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
-
- count_label = lv_label_create(NULL, NULL);
- lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
-
- btn1 = lv_btn_create(
- NULL, NULL); /*Create a button on the currently loaded screen*/
- lv_obj_set_event_cb(
- btn1,
- btn_event_cb); /*Set function to be called when the button is released*/
- lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0); /*Align below the label*/
-
- /*Create a label on the button*/
- lv_obj_t *btn_label = lv_label_create(btn1, NULL);
- lv_label_set_text(btn_label, "Click ++");
-
- label_count1 = lv_label_create(NULL, NULL);
- lv_label_set_text(label_count1, "1");
- lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
-
- /* set up a timer */
- user_timer_t timer;
- timer = api_timer_create(10, true, false, timer1_update);
- if (timer)
- api_timer_restart(timer, 10);
- else
- printf("Fail to create timer.\n");
-}
-
-static void
-btn_event_cb(lv_obj_t *btn, lv_event_t event)
-{
- if (event == LV_EVENT_RELEASED) {
- label_count1_value++;
- snprintf(label_count1_str, sizeof(label_count1_str), "%d",
- label_count1_value);
- lv_label_set_text(label_count1, label_count1_str);
- if (label_count1_value == 100)
- label_count1_value = 0;
- }
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/iwasm_main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/iwasm_main.c
deleted file mode 100644
index 61c7bb39d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/iwasm_main.c
+++ /dev/null
@@ -1,564 +0,0 @@
-
-#ifndef CONNECTION_UART
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#else
-#include <termios.h>
-#endif
-
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <unistd.h>
-#include <strings.h>
-
-#include "runtime_lib.h"
-#include "runtime_timer.h"
-#include "native_interface.h"
-#include "app_manager_export.h"
-#include "bh_platform.h"
-#include "runtime_sensor.h"
-#include "bi-inc/attr_container.h"
-#include "module_wasm_app.h"
-#include "wasm_export.h"
-#include "wgl.h"
-
-#include "lv_drivers/display/monitor.h"
-#include "lv_drivers/indev/mouse.h"
-
-#define MAX 2048
-
-#ifndef CONNECTION_UART
-#define SA struct sockaddr
-static char *host_address = "127.0.0.1";
-static int port = 8888;
-#else
-static char *uart_device = "/dev/ttyS2";
-static int baudrate = B115200;
-#endif
-
-extern bool
-init_sensor_framework();
-extern void
-exit_sensor_framework();
-extern void
-exit_connection_framework();
-extern int
-aee_host_msg_callback(void *msg, uint32_t msg_len);
-extern bool
-init_connection_framework();
-
-#ifndef CONNECTION_UART
-int listenfd = -1;
-int sockfd = -1;
-static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
-#else
-int uartfd = -1;
-#endif
-
-#ifndef CONNECTION_UART
-static bool server_mode = false;
-
-// Function designed for chat between client and server.
-void *
-func(void *arg)
-{
- char buff[MAX];
- int n;
- struct sockaddr_in servaddr;
-
- while (1) {
- if (sockfd != -1)
- close(sockfd);
- // socket create and verification
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd == -1) {
- printf("socket creation failed...\n");
- return NULL;
- }
- else
- printf("Socket successfully created..\n");
- bzero(&servaddr, sizeof(servaddr));
- // assign IP, PORT
- servaddr.sin_family = AF_INET;
- servaddr.sin_addr.s_addr = inet_addr(host_address);
- servaddr.sin_port = htons(port);
-
- // connect the client socket to server socket
- if (connect(sockfd, (SA *)&servaddr, sizeof(servaddr)) != 0) {
- printf("connection with the server failed...\n");
- sleep(10);
- continue;
- }
- else {
- printf("connected to the server..\n");
- }
-
- // infinite loop for chat
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
- // print buffer which contains the client contents
- // fprintf(stderr, "recieved %d bytes from host: %s", n, buff);
-
- // socket disconnected
- if (n <= 0)
- break;
-
- aee_host_msg_callback(buff, n);
- }
- }
-
- // After chatting close the socket
- close(sockfd);
-}
-
-static bool
-host_init()
-{
- return true;
-}
-
-int
-host_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- if (pthread_mutex_trylock(&sock_lock) == 0) {
- if (sockfd == -1) {
- pthread_mutex_unlock(&sock_lock);
- return 0;
- }
-
- ret = write(sockfd, buf, size);
-
- pthread_mutex_unlock(&sock_lock);
- return ret;
- }
-
- return -1;
-}
-
-void
-host_destroy()
-{
- if (server_mode)
- close(listenfd);
-
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- pthread_mutex_unlock(&sock_lock);
-}
-
-/* clang-format off */
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-/* clang-format on */
-
-void *
-func_server_mode(void *arg)
-{
- int clilent;
- struct sockaddr_in serv_addr, cli_addr;
- int n;
- char buff[MAX];
- struct sigaction sa;
-
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGPIPE, &sa, 0);
-
- /* First call to socket() function */
- listenfd = socket(AF_INET, SOCK_STREAM, 0);
-
- if (listenfd < 0) {
- perror("ERROR opening socket");
- exit(1);
- }
-
- /* Initialize socket structure */
- bzero((char *)&serv_addr, sizeof(serv_addr));
-
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = INADDR_ANY;
- serv_addr.sin_port = htons(port);
-
- /* Now bind the host address using bind() call.*/
- if (bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
- perror("ERROR on binding");
- exit(1);
- }
-
- listen(listenfd, 5);
- clilent = sizeof(cli_addr);
-
- while (1) {
- pthread_mutex_lock(&sock_lock);
-
- sockfd = accept(listenfd, (struct sockaddr *)&cli_addr, &clilent);
-
- pthread_mutex_unlock(&sock_lock);
-
- if (sockfd < 0) {
- perror("ERROR on accept");
- exit(1);
- }
-
- printf("connection established!\n");
-
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
-
- // socket disconnected
- if (n <= 0) {
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- sockfd = -1;
- pthread_mutex_unlock(&sock_lock);
-
- sleep(2);
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
- }
-}
-
-#else
-static int
-parse_baudrate(int baud)
-{
- switch (baud) {
- case 9600:
- return B9600;
- case 19200:
- return B19200;
- case 38400:
- return B38400;
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
- case 2500000:
- return B2500000;
- case 3000000:
- return B3000000;
- case 3500000:
- return B3500000;
- case 4000000:
- return B4000000;
- default:
- return -1;
- }
-}
-static bool
-uart_init(const char *device, int baudrate, int *fd)
-{
- int uart_fd;
- struct termios uart_term;
-
- uart_fd = open(device, O_RDWR | O_NOCTTY);
-
- if (uart_fd <= 0)
- return false;
-
- memset(&uart_term, 0, sizeof(uart_term));
- uart_term.c_cflag = baudrate | CS8 | CLOCAL | CREAD;
- uart_term.c_iflag = IGNPAR;
- uart_term.c_oflag = 0;
-
- /* set noncanonical mode */
- uart_term.c_lflag = 0;
- uart_term.c_cc[VTIME] = 30;
- uart_term.c_cc[VMIN] = 1;
- tcflush(uart_fd, TCIFLUSH);
-
- if (tcsetattr(uart_fd, TCSANOW, &uart_term) != 0) {
- close(uart_fd);
- return false;
- }
-
- *fd = uart_fd;
-
- return true;
-}
-
-static void *
-func_uart_mode(void *arg)
-{
- int n;
- char buff[MAX];
-
- if (!uart_init(uart_device, baudrate, &uartfd)) {
- printf("open uart fail! %s\n", uart_device);
- return NULL;
- }
-
- for (;;) {
- bzero(buff, MAX);
-
- n = read(uartfd, buff, sizeof(buff));
-
- if (n <= 0) {
- close(uartfd);
- uartfd = -1;
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
-
- return NULL;
-}
-
-static int
-uart_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- ret = write(uartfd, buf, size);
-
- return ret;
-}
-
-static void
-uart_destroy()
-{
- close(uartfd);
-}
-
-/* clang-format off */
-static host_interface interface = {
- .send = uart_send,
- .destroy = uart_destroy
-};
-/* clang-format on */
-
-#endif
-
-static char global_heap_buf[270 * 1024] = { 0 };
-
-/* clang-format off */
-static void showUsage()
-{
-#ifndef CONNECTION_UART
- printf("Usage:\n");
- printf("\nWork as TCP server mode:\n");
- printf("\tvgl_wasm_runtime -s|--server_mode -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Port> represents the port that would be listened on and the default is 8888\n");
- printf("\nWork as TCP client mode:\n");
- printf("\tvgl_wasm_runtime -a|--host_address <Host Address> -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Host Address> represents the network address of host and the default is 127.0.0.1\n");
- printf("\t<Port> represents the listen port of host and the default is 8888\n");
-#else
- printf("Usage:\n");
- printf("\tvgl_wasm_runtime -u <Uart Device> -b <Baudrate>\n\n");
- printf("where\n");
- printf("\t<Uart Device> represents the UART device name and the default is /dev/ttyS2\n");
- printf("\t<Baudrate> represents the UART device baudrate and the default is 115200\n");
-#endif
-}
-/* clang-format on */
-
-static bool
-parse_args(int argc, char *argv[])
-{
- int c;
-
- while (1) {
- int optIndex = 0;
- static struct option longOpts[] = {
-#ifndef CONNECTION_UART
- { "server_mode", no_argument, NULL, 's' },
- { "host_address", required_argument, NULL, 'a' },
- { "port", required_argument, NULL, 'p' },
-#else
- { "uart", required_argument, NULL, 'u' },
- { "baudrate", required_argument, NULL, 'b' },
-#endif
- { "help", required_argument, NULL, 'h' },
- { 0, 0, 0, 0 }
- };
-
- c = getopt_long(argc, argv, "sa:p:u:b:h", longOpts, &optIndex);
- if (c == -1)
- break;
-
- switch (c) {
-#ifndef CONNECTION_UART
- case 's':
- server_mode = true;
- break;
- case 'a':
- host_address = optarg;
- printf("host address: %s\n", host_address);
- break;
- case 'p':
- port = atoi(optarg);
- printf("port: %d\n", port);
- break;
-#else
- case 'u':
- uart_device = optarg;
- printf("uart device: %s\n", uart_device);
- break;
- case 'b':
- baudrate = parse_baudrate(atoi(optarg));
- printf("uart baudrate: %s\n", optarg);
- break;
-#endif
- case 'h':
- showUsage();
- return false;
- default:
- showUsage();
- return false;
- }
- }
-
- return true;
-}
-
-/**
- * Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics
- * library
- */
-static void
-hal_init(void)
-{
- /* Use the 'monitor' driver which creates window on PC's monitor to simulate
- * a display*/
- monitor_init();
-
- /*Create a display buffer*/
- static lv_disp_buf_t disp_buf1;
- static lv_color_t buf1_1[480 * 10];
- lv_disp_buf_init(&disp_buf1, buf1_1, NULL, 480 * 10);
-
- /*Create a display*/
- lv_disp_drv_t disp_drv;
-
- /*Basic initialization*/
- memset(&disp_drv, 0, sizeof(disp_drv));
- lv_disp_drv_init(&disp_drv);
- disp_drv.buffer = &disp_buf1;
- disp_drv.flush_cb = monitor_flush;
- // disp_drv.hor_res = 200;
- // disp_drv.ver_res = 100;
- lv_disp_drv_register(&disp_drv);
-
- /* Add the mouse as input device
- * Use the 'mouse' driver which reads the PC's mouse*/
- mouse_init();
- lv_indev_drv_t indev_drv;
- lv_indev_drv_init(&indev_drv); /*Basic initialization*/
- indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read_cb =
- mouse_read; /*This function will be called periodically (by the library)
- to get the mouse position and state*/
- lv_indev_drv_register(&indev_drv);
-}
-
-// Driver function
-int
-iwasm_main(int argc, char *argv[])
-{
- RuntimeInitArgs init_args;
- korp_tid tid;
-
- if (!parse_args(argc, argv))
- return -1;
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- if (!init_connection_framework()) {
- goto fail1;
- }
-
- wgl_init();
-
- hal_init();
-
- if (!init_sensor_framework()) {
- goto fail2;
- }
-
- /* timer manager */
- if (!init_wasm_timer()) {
- goto fail3;
- }
-
-#ifndef CONNECTION_UART
- if (server_mode)
- os_thread_create(&tid, func_server_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
- else
- os_thread_create(&tid, func, NULL, BH_APPLET_PRESERVED_STACK_SIZE);
-#else
- os_thread_create(&tid, func_uart_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
-#endif
-
- app_manager_startup(&interface);
-
- exit_wasm_timer();
-
-fail3:
- exit_sensor_framework();
-
-fail2:
- wgl_exit();
- exit_connection_framework();
-
-fail1:
- wasm_runtime_destroy();
- return -1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/lv_drv_conf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/lv_drv_conf.h
deleted file mode 100644
index d216a3e90..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/lv_drv_conf.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/**
- * @file lv_drv_conf.h
- *
- */
-
-/*
- * COPY THIS FILE AS lv_drv_conf.h
- */
-
-#if 1 /*Set it to "1" to enable the content*/
-
-#ifndef LV_DRV_CONF_H
-#define LV_DRV_CONF_H
-
-#include "lv_conf.h"
-
-/*********************
- * DELAY INTERFACE
- *********************/
-#define LV_DRV_DELAY_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_DELAY_US(us) /*delay_us(us)*/ /*Delay the given number of microseconds*/
-#define LV_DRV_DELAY_MS(ms) /*delay_ms(ms)*/ /*Delay the given number of milliseconds*/
-
-/*********************
- * DISPLAY INTERFACE
- *********************/
-
-/*------------
- * Common
- *------------*/
-#define LV_DRV_DISP_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_DISP_CMD_DATA(val) /*pin_x_set(val)*/ /*Set the command/data pin to 'val'*/
-#define LV_DRV_DISP_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
-
-/*---------
- * SPI
- *---------*/
-#define LV_DRV_DISP_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
-#define LV_DRV_DISP_SPI_WR_BYTE(data) /*spi_wr(data)*/ /*Write a byte the SPI bus*/
-#define LV_DRV_DISP_SPI_WR_ARRAY(adr, n) /*spi_wr_mem(adr, n)*/ /*Write 'n' bytes to SPI bus from 'adr'*/
-
-/*------------------
- * Parallel port
- *-----------------*/
-#define LV_DRV_DISP_PAR_CS(val) /*par_cs_set(val)*/ /*Set the Parallel port's Chip select to 'val'*/
-#define LV_DRV_DISP_PAR_SLOW /*par_slow()*/ /*Set low speed on the parallel port*/
-#define LV_DRV_DISP_PAR_FAST /*par_fast()*/ /*Set high speed on the parallel port*/
-#define LV_DRV_DISP_PAR_WR_WORD(data) /*par_wr(data)*/ /*Write a word to the parallel port*/
-#define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/
-
-/***************************
- * INPUT DEVICE INTERFACE
- ***************************/
-
-/*----------
- * Common
- *----------*/
-#define LV_DRV_INDEV_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_INDEV_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
-#define LV_DRV_INDEV_IRQ_READ 0 /*pn_x_read()*/ /*Read the IRQ pin*/
-
-/*---------
- * SPI
- *---------*/
-#define LV_DRV_INDEV_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
-#define LV_DRV_INDEV_SPI_XCHG_BYTE(data) 0 /*spi_xchg(val)*/ /*Write 'val' to SPI and give the read value*/
-
-/*---------
- * I2C
- *---------*/
-#define LV_DRV_INDEV_I2C_START /*i2c_start()*/ /*Make an I2C start*/
-#define LV_DRV_INDEV_I2C_STOP /*i2c_stop()*/ /*Make an I2C stop*/
-#define LV_DRV_INDEV_I2C_RESTART /*i2c_restart()*/ /*Make an I2C restart*/
-#define LV_DRV_INDEV_I2C_WR(data) /*i2c_wr(data)*/ /*Write a byte to the I1C bus*/
-#define LV_DRV_INDEV_I2C_READ(last_read) 0 /*i2c_rd()*/ /*Read a byte from the I2C bud*/
-
-
-/*********************
- * DISPLAY DRIVERS
- *********************/
-
-/*-------------------
- * Monitor of PC
- *-------------------*/
-#ifndef USE_MONITOR
-# define USE_MONITOR 1
-#endif
-
-#if USE_MONITOR
-# define MONITOR_HOR_RES LV_HOR_RES_MAX
-# define MONITOR_VER_RES LV_VER_RES_MAX
-
-/* Scale window by this factor (useful when simulating small screens) */
-# define MONITOR_ZOOM 1
-
-/* Used to test true double buffering with only address changing.
- * Set LV_VDB_SIZE = (LV_HOR_RES * LV_VER_RES) and LV_VDB_DOUBLE = 1 and LV_COLOR_DEPTH = 32" */
-# define MONITOR_DOUBLE_BUFFERED 0
-
-/*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
-# define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h>
-
-/*Different rendering might be used if running in a Virtual machine*/
-# define MONITOR_VIRTUAL_MACHINE 0
-
-/*Open two windows to test multi display support*/
-# define MONITOR_DUAL 0
-#endif
-
-/*-----------------------------------
- * Native Windows (including mouse)
- *----------------------------------*/
-#ifndef USE_WINDOWS
-# define USE_WINDOWS 0
-#endif
-
-#define USE_WINDOWS 0
-#if USE_WINDOWS
-# define WINDOW_HOR_RES 480
-# define WINDOW_VER_RES 320
-#endif
-
-/*----------------
- * SSD1963
- *--------------*/
-#ifndef USE_SSD1963
-# define USE_SSD1963 0
-#endif
-
-#if USE_SSD1963
-# define SSD1963_HOR_RES LV_HOR_RES
-# define SSD1963_VER_RES LV_VER_RES
-# define SSD1963_HT 531
-# define SSD1963_HPS 43
-# define SSD1963_LPS 8
-# define SSD1963_HPW 10
-# define SSD1963_VT 288
-# define SSD1963_VPS 12
-# define SSD1963_FPS 4
-# define SSD1963_VPW 10
-# define SSD1963_HS_NEG 0 /*Negative hsync*/
-# define SSD1963_VS_NEG 0 /*Negative vsync*/
-# define SSD1963_ORI 0 /*0, 90, 180, 270*/
-# define SSD1963_COLOR_DEPTH 16
-#endif
-
-/*----------------
- * R61581
- *--------------*/
-#ifndef USE_R61581
-# define USE_R61581 0
-#endif
-
-#if USE_R61581
-# define R61581_HOR_RES LV_HOR_RES
-# define R61581_VER_RES LV_VER_RES
-# define R61581_HSPL 0 /*HSYNC signal polarity*/
-# define R61581_HSL 10 /*HSYNC length (Not Implemented)*/
-# define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/
-# define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */
-# define R61581_VSPL 0 /*VSYNC signal polarity*/
-# define R61581_VSL 10 /*VSYNC length (Not Implemented)*/
-# define R61581_VFP 8 /*Vertical Front poarch*/
-# define R61581_VBP 8 /*Vertical Back poarch */
-# define R61581_DPL 0 /*DCLK signal polarity*/
-# define R61581_EPL 1 /*ENABLE signal polarity*/
-# define R61581_ORI 0 /*0, 180*/
-# define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/
-#endif
-
-/*------------------------------
- * ST7565 (Monochrome, low res.)
- *-----------------------------*/
-#ifndef USE_ST7565
-# define USE_ST7565 0
-#endif
-
-#if USE_ST7565
-/*No settings*/
-#endif /*USE_ST7565*/
-
-/*-----------------------------------------
- * Linux frame buffer device (/dev/fbx)
- *-----------------------------------------*/
-#ifndef USE_FBDEV
-# define USE_FBDEV 1
-#endif
-
-#if USE_FBDEV
-# define FBDEV_PATH "/dev/fb0"
-#endif
-
-/*********************
- * INPUT DEVICES
- *********************/
-
-/*--------------
- * XPT2046
- *--------------*/
-#ifndef USE_XPT2046
-# define USE_XPT2046 0
-#endif
-
-#if USE_XPT2046
-# define XPT2046_HOR_RES 480
-# define XPT2046_VER_RES 320
-# define XPT2046_X_MIN 200
-# define XPT2046_Y_MIN 200
-# define XPT2046_X_MAX 3800
-# define XPT2046_Y_MAX 3800
-# define XPT2046_AVG 4
-# define XPT2046_INV 0
-#endif
-
-/*-----------------
- * FT5406EE8
- *-----------------*/
-#ifndef USE_FT5406EE8
-# define USE_FT5406EE8 0
-#endif
-
-#if USE_FT5406EE8
-# define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/
-#endif
-
-/*---------------
- * AD TOUCH
- *--------------*/
-#ifndef USE_AD_TOUCH
-# define USE_AD_TOUCH 0
-#endif
-
-#if USE_AD_TOUCH
-/*No settings*/
-#endif
-
-
-/*---------------------------------------
- * Mouse or touchpad on PC (using SDL)
- *-------------------------------------*/
-#ifndef USE_MOUSE
-# define USE_MOUSE 1
-#endif
-
-#if USE_MOUSE
-/*No settings*/
-#endif
-
-/*-------------------------------------------
- * Mousewheel as encoder on PC (using SDL)
- *------------------------------------------*/
-#ifndef USE_MOUSEWHEEL
-# define USE_MOUSEWHEEL 1
-#endif
-
-#if USE_MOUSEWHEEL
-/*No settings*/
-#endif
-
-/*-------------------------------------------------
- * Touchscreen as libinput interface (for Linux based systems)
- *------------------------------------------------*/
-#ifndef USE_LIBINPUT
-# define USE_LIBINPUT 0
-#endif
-
-#if USE_LIBINPUT
-# define LIBINPUT_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
-#endif /*USE_LIBINPUT*/
-
-/*-------------------------------------------------
- * Mouse or touchpad as evdev interface (for Linux based systems)
- *------------------------------------------------*/
-#ifndef USE_EVDEV
-# define USE_EVDEV 0
-#endif
-
-#if USE_EVDEV
-# define EVDEV_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
-# define EVDEV_SWAP_AXES 0 /*Swap the x and y axes of the touchscreen*/
-
-# define EVDEV_SCALE 0 /* Scale input, e.g. if touchscreen resolution does not match display resolution */
-# if EVDEV_SCALE
-# define EVDEV_SCALE_HOR_RES (4096) /* Horizontal resolution of touchscreen */
-# define EVDEV_SCALE_VER_RES (4096) /* Vertical resolution of touchscreen */
-# endif /*EVDEV_SCALE*/
-
-# define EVDEV_CALIBRATE 0 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
-# if EVDEV_CALIBRATE
-# define EVDEV_HOR_MIN 3800 /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
-# define EVDEV_HOR_MAX 200
-# define EVDEV_VER_MIN 200
-# define EVDEV_VER_MAX 3800
-# endif /*EVDEV_SCALE*/
-#endif /*USE_EVDEV*/
-
-/*-------------------------------
- * Keyboard of a PC (using SDL)
- *------------------------------*/
-#ifndef USE_KEYBOARD
-# define USE_KEYBOARD 1
-#endif
-
-#if USE_KEYBOARD
-/*No settings*/
-#endif
-
-#endif /*LV_DRV_CONF_H*/
-
-#endif /*End of "Content enable"*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/main.c
deleted file mode 100644
index 741e54fd8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/linux/main.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include <stdlib.h>
-#include <sys/time.h>
-
-extern int
-iwasm_main(int argc, char *argv[]);
-
-int
-main(int argc, char *argv[])
-{
- return iwasm_main(argc, argv);
-}
-
-int
-time_get_ms()
-{
- static struct timeval tv;
- gettimeofday(&tv, NULL);
- long long time_in_mill = (tv.tv_sec) * 1000 + (tv.tv_usec) / 1000;
-
- return (int)time_in_mill;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/LICENSE b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/LICENSE
deleted file mode 100644
index 8f71f43fe..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c
deleted file mode 100644
index cdad9dac2..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/**
- * @file XPT2046.c
- */
-/*********************
- * INCLUDES
- *********************/
-#include "XPT2046.h"
-#include "board_config.h"
-#include "stdio.h"
-#include <string.h>
-#include "drivers/spi.h"
-
-#include "zephyr.h"
-#include "kernel.h"
-
-#if USE_XPT2046
-
-#include <stddef.h>
-
-#define abs(x) ((x) < 0 ? -(x) : (x))
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-static void
-xpt2046_corr(int16_t *x, int16_t *y);
-#if 0
-static void xpt2046_avg(int16_t * x, int16_t * y);
-#endif
-
-/**********************
- * STATIC VARIABLES
- **********************/
-int16_t avg_buf_x[XPT2046_AVG];
-int16_t avg_buf_y[XPT2046_AVG];
-uint8_t avg_last;
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-
-/**
- * Initialize the XPT2046
- */
-struct device *input_dev;
-
-struct spi_config spi_conf_xpt2046;
-struct spi_cs_control xpt2046_cs_ctrl;
-struct device *xpt2046_pen_gpio_dev;
-static struct gpio_callback gpio_cb;
-lv_indev_data_t touch_point;
-lv_indev_data_t last_touch_point;
-
-#define TOUCH_READ_THREAD_STACK_SIZE 4096
-static K_THREAD_STACK_DEFINE(touch_read_thread_stack,
- TOUCH_READ_THREAD_STACK_SIZE);
-static struct k_thread touch_thread_data;
-static struct k_sem sem_touch_read;
-
-K_MUTEX_DEFINE(spi_display_touch_mutex);
-
-int cnt = 0;
-int touch_read_times = 0;
-int last_pen_interrupt_time = 0;
-void
-xpt2046_pen_gpio_callback(struct device *port, struct gpio_callback *cb,
- u32_t pins)
-{
- cnt++;
- if ((k_uptime_get_32() - last_pen_interrupt_time) > 500) {
- k_sem_give(&sem_touch_read);
- touch_read_times++;
- last_pen_interrupt_time = k_uptime_get_32();
- }
-}
-
-void
-disable_pen_interrupt()
-{
- int ret = 0;
- ret = gpio_disable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
- if (ret != 0) {
- printf("gpio_pin_configure GPIO_INPUT failed\n");
- }
-}
-void
-enable_pen_interrupt()
-{
- int ret = 0;
- ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
- if (ret != 0) {
- printf("gpio_pin_configure failed\n");
- }
-}
-
-void
-touch_screen_read_thread()
-{
- int i;
- bool ret = false;
-
- for (;;) {
- k_sem_take(&sem_touch_read, K_FOREVER);
- memset(&last_touch_point, 0, sizeof(lv_indev_data_t));
- memset(&touch_point, 0, sizeof(lv_indev_data_t));
- memset(avg_buf_x, 0, sizeof(avg_buf_x));
- memset(avg_buf_y, 0, sizeof(avg_buf_y));
- k_mutex_lock(&spi_display_touch_mutex, K_FOREVER);
- disable_pen_interrupt();
- for (i = 0; i < 100; i++) {
- ret = xpt2046_read(&touch_point);
- if (ret) {
- if ((abs(last_touch_point.point.x - touch_point.point.x) < 4)
- && (abs(last_touch_point.point.y - touch_point.point.y)
- < 4)) {
- break;
- }
- last_touch_point = touch_point;
- }
- }
- enable_pen_interrupt();
- k_mutex_unlock(&spi_display_touch_mutex);
- }
-}
-
-void
-xpt2046_init(void)
-{
- int ret;
- input_dev = device_get_binding(XPT2046_SPI_DEVICE_NAME);
-
- if (input_dev == NULL) {
- printf("device not found. Aborting test.");
- return;
- }
- memset((void *)&touch_point, 0, sizeof(lv_indev_data_t));
-
- spi_conf_xpt2046.frequency = XPT2046_SPI_MAX_FREQUENCY;
- spi_conf_xpt2046.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
- spi_conf_xpt2046.slave = 0;
- spi_conf_xpt2046.cs = NULL;
-#ifdef XPT2046_CS_GPIO_CONTROLLER
- xpt2046_cs_ctrl.gpio_dev = device_get_binding(XPT2046_CS_GPIO_CONTROLLER);
- if (xpt2046_cs_ctrl.gpio_dev == NULL) {
- printk("Cannot find %s!\n", XPT2046_CS_GPIO_CONTROLLER);
- return;
- }
- gpio_pin_configure(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN,
- GPIO_OUTPUT);
- gpio_pin_set(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
- xpt2046_cs_ctrl.gpio_pin = XPT2046_CS_GPIO_PIN;
- xpt2046_cs_ctrl.delay = 0;
- spi_conf_xpt2046.cs = &xpt2046_cs_ctrl;
-
-#endif
-
-#ifdef XPT2046_PEN_GPIO_CONTROLLER
-
- xpt2046_pen_gpio_dev = device_get_binding(XPT2046_PEN_GPIO_CONTROLLER);
- if (!xpt2046_pen_gpio_dev) {
- printk("Cannot find %s!\n", XPT2046_PEN_GPIO_CONTROLLER);
- return;
- }
- /* Setup GPIO input */
- ret = gpio_pin_configure(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN,
- (GPIO_INPUT | GPIO_INT_ENABLE | GPIO_INT_EDGE
- | GPIO_INT_LOW_0 | GPIO_INT_DEBOUNCE));
- if (ret) {
- printk("Error configuring pin %d!\n", XPT2046_PEN_GPIO_PIN);
- }
-
- gpio_init_callback(&gpio_cb, xpt2046_pen_gpio_callback,
- BIT(XPT2046_PEN_GPIO_PIN));
-
- ret = gpio_add_callback(xpt2046_pen_gpio_dev, &gpio_cb);
- if (ret) {
- printk("gpio_add_callback error\n");
- }
- ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
- if (ret) {
- printk("gpio_enable_callback error\n");
- }
-#endif
-
- k_sem_init(&sem_touch_read, 0, 1);
-
- k_thread_create(&touch_thread_data, touch_read_thread_stack,
- TOUCH_READ_THREAD_STACK_SIZE, touch_screen_read_thread,
- NULL, NULL, NULL, 5, 0, K_NO_WAIT);
- printf("xpt2046_init ok \n");
-}
-
-/**
- * Get the current position and state of the touchpad
- * @param data store the read data here
- * @return false: because no ore data to be read
- */
-bool
-xpt2046_read(lv_indev_data_t *data)
-{
- static int16_t last_x = 0;
- static int16_t last_y = 0;
- bool valid = true;
- int s32_ret = 0;
-
- int16_t x = 0;
- int16_t y = 0;
-
- char tx1[16] = { 0 };
- char rx1[16] = { 0 };
-
- struct spi_buf tx_buf = { .buf = &tx1, .len = 3 };
- struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
- struct spi_buf rx_buf = { .buf = &rx1, .len = 3 };
- struct spi_buf_set rx_bufs = { .buffers = &rx_buf, .count = 1 };
-
- tx1[0] = CMD_X_READ;
- s32_ret = spi_transceive(input_dev, &spi_conf_xpt2046, &tx_bufs, &rx_bufs);
- if (s32_ret != 0) {
- printf("spi_transceive return failed:%d\n", s32_ret);
- }
- x = rx1[1] << 8;
- x += rx1[2];
-
- tx1[0] = CMD_Y_READ;
- s32_ret = spi_transceive(input_dev, &spi_conf_xpt2046, &tx_bufs, &rx_bufs);
- if (s32_ret != 0) {
- printf("spi_transceive return failed:%d\n", s32_ret);
- }
- y = rx1[1] << 8;
- y += rx1[2];
- x = x >> 3;
- y = y >> 3;
-
- xpt2046_corr(&x, &y);
- if (y <= 0 || (x > 320)) {
- valid = false;
- }
-
- last_x = x;
- last_y = y;
-
- data->point.x = x;
- data->point.y = y;
- data->state = valid == false ? LV_INDEV_STATE_REL : LV_INDEV_STATE_PR;
-
- return valid;
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-static void
-xpt2046_corr(int16_t *x, int16_t *y)
-{
-#if XPT2046_XY_SWAP != 0
- int16_t swap_tmp;
- swap_tmp = *x;
- *x = *y;
- *y = swap_tmp;
-#endif
-
- if ((*x) > XPT2046_X_MIN)
- (*x) -= XPT2046_X_MIN;
- else
- (*x) = 0;
-
- if ((*y) > XPT2046_Y_MIN)
- (*y) -= XPT2046_Y_MIN;
- else
- (*y) = 0;
-
- (*x) = (uint32_t)((uint32_t)(*x) * XPT2046_HOR_RES)
- / (XPT2046_X_MAX - XPT2046_X_MIN);
-
- (*y) = (uint32_t)((uint32_t)(*y) * XPT2046_VER_RES)
- / (XPT2046_Y_MAX - XPT2046_Y_MIN);
-
-#if XPT2046_X_INV != 0
- (*x) = XPT2046_HOR_RES - (*x);
-#endif
-
-#if XPT2046_Y_INV != 0
- (*y) = XPT2046_VER_RES - (*y);
-#endif
-}
-
-#if 0
-static void xpt2046_avg(int16_t * x, int16_t * y)
-{
- /*Shift out the oldest data*/
- uint8_t i;
- for (i = XPT2046_AVG - 1; i > 0; i--) {
- avg_buf_x[i] = avg_buf_x[i - 1];
- avg_buf_y[i] = avg_buf_y[i - 1];
- }
-
- /*Insert the new point*/
- avg_buf_x[0] = *x;
- avg_buf_y[0] = *y;
- if (avg_last < XPT2046_AVG)
- avg_last++;
-
- /*Sum the x and y coordinates*/
- int32_t x_sum = 0;
- int32_t y_sum = 0;
- for (i = 0; i < avg_last; i++) {
- x_sum += avg_buf_x[i];
- y_sum += avg_buf_y[i];
- }
-
- /*Normalize the sums*/
- (*x) = (int32_t) x_sum / avg_last;
- (*y) = (int32_t) y_sum / avg_last;
-}
-#endif
-
-bool
-touchscreen_read(lv_indev_data_t *data)
-{
- /*Store the collected data*/
- data->point.x = last_touch_point.point.x;
- data->point.y = last_touch_point.point.y;
- data->state = last_touch_point.state;
-
- if (last_touch_point.state == LV_INDEV_STATE_PR) {
- last_touch_point.state = LV_INDEV_STATE_REL;
- }
- return false;
-}
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.h
deleted file mode 100644
index 228321dcc..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @file XPT2046.h
- *
- */
-
-#ifndef XPT2046_H
-#define XPT2046_H
-
-#define USE_XPT2046 1
-
-#define XPT2046_HOR_RES 320
-#define XPT2046_VER_RES 240
-#define XPT2046_X_MIN 200
-#define XPT2046_Y_MIN 200
-#define XPT2046_X_MAX 3800
-#define XPT2046_Y_MAX 3800
-#define XPT2046_AVG 4
-#define XPT2046_INV 0
-
-#define CMD_X_READ 0b10010000
-#define CMD_Y_READ 0b11010000
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*********************
- * INCLUDES
- *********************/
-
-#if USE_XPT2046
-#include <autoconf.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include "lv_hal/lv_hal_indev.h"
-#include "device.h"
-#include "drivers/gpio.h"
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * GLOBAL PROTOTYPES
- **********************/
-void
-xpt2046_init(void);
-bool
-xpt2046_read(lv_indev_data_t *data);
-
-/**********************
- * MACROS
- **********************/
-
-#endif /* USE_XPT2046 */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* XPT2046_H */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/board_config.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/board_config.h
deleted file mode 100644
index d7ea279a9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/board_config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-#include "pin_config_stm32.h"
-
-#endif /* __BOARD_CONFIG_H__ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display.h
deleted file mode 100644
index 8354ca378..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display.h
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/**
- * @file
- * @brief Public API for display drivers and applications
- */
-
-#ifndef ZEPHYR_INCLUDE_DISPLAY_H_
-#define ZEPHYR_INCLUDE_DISPLAY_H_
-
-/**
- * @brief Display Interface
- * @defgroup display_interface Display Interface
- * @ingroup display_interfaces
- * @{
- */
-
-#include <device.h>
-#include <stddef.h>
-#include <zephyr/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum display_pixel_format {
- PIXEL_FORMAT_RGB_888 = BIT(0),
- PIXEL_FORMAT_MONO01 = BIT(1), /* 0=Black 1=White */
- PIXEL_FORMAT_MONO10 = BIT(2), /* 1=Black 0=White */
- PIXEL_FORMAT_ARGB_8888 = BIT(3),
- PIXEL_FORMAT_RGB_565 = BIT(4),
-};
-
-enum display_screen_info {
- /**
- * If selected, one octet represents 8 pixels ordered vertically,
- * otherwise ordered horizontally.
- */
- SCREEN_INFO_MONO_VTILED = BIT(0),
- /**
- * If selected, the MSB represents the first pixel,
- * otherwise MSB represents the last pixel.
- */
- SCREEN_INFO_MONO_MSB_FIRST = BIT(1),
- /**
- * Electrophoretic Display.
- */
- SCREEN_INFO_EPD = BIT(2),
- /**
- * Screen has two alternating ram buffers
- */
- SCREEN_INFO_DOUBLE_BUFFER = BIT(3),
-};
-
-/**
- * @enum display_orientation
- * @brief Enumeration with possible display orientation
- *
- */
-enum display_orientation {
- DISPLAY_ORIENTATION_NORMAL,
- DISPLAY_ORIENTATION_ROTATED_90,
- DISPLAY_ORIENTATION_ROTATED_180,
- DISPLAY_ORIENTATION_ROTATED_270,
-};
-
-/**
- * @struct display_capabilities
- * @brief Structure holding display capabilities
- *
- * @var u16_t display_capabilities::x_resolution
- * Display resolution in the X direction
- *
- * @var u16_t display_capabilities::y_resolution
- * Display resolution in the Y direction
- *
- * @var u32_t display_capabilities::supported_pixel_formats
- * Bitwise or of pixel formats supported by the display
- *
- * @var u32_t display_capabilities::screen_info
- * Information about display panel
- *
- * @var enum display_pixel_format display_capabilities::current_pixel_format
- * Currently active pixel format for the display
- *
- * @var enum display_orientation display_capabilities::current_orientation
- * Current display orientation
- *
- */
-struct display_capabilities {
- u16_t x_resolution;
- u16_t y_resolution;
- u32_t supported_pixel_formats;
- u32_t screen_info;
- enum display_pixel_format current_pixel_format;
- enum display_orientation current_orientation;
-};
-
-/**
- * @struct display_buffer_descriptor
- * @brief Structure to describe display data buffer layout
- *
- * @var u32_t display_buffer_descriptor::buf_size
- * Data buffer size in bytes
- *
- * @var u16_t display_buffer_descriptor::width
- * Data buffer row width in pixels
- *
- * @var u16_t display_buffer_descriptor::height
- * Data buffer column height in pixels
- *
- * @var u16_t display_buffer_descriptor::pitch
- * Number of pixels between consecutive rows in the data buffer
- *
- */
-struct display_buffer_descriptor {
- u32_t buf_size;
- u16_t width;
- u16_t height;
- u16_t pitch;
-};
-
-/**
- * @typedef display_blanking_on_api
- * @brief Callback API to turn on display blanking
- * See display_blanking_on() for argument description
- */
-typedef int (*display_blanking_on_api)(const struct device *dev);
-
-/**
- * @typedef display_blanking_off_api
- * @brief Callback API to turn off display blanking
- * See display_blanking_off() for argument description
- */
-typedef int (*display_blanking_off_api)(const struct device *dev);
-
-/**
- * @typedef display_write_api
- * @brief Callback API for writing data to the display
- * See display_write() for argument description
- */
-typedef int (*display_write_api)(const struct device *dev, const u16_t x,
- const u16_t y,
- const struct display_buffer_descriptor *desc,
- const void *buf);
-
-/**
- * @typedef display_read_api
- * @brief Callback API for reading data from the display
- * See display_read() for argument description
- */
-typedef int (*display_read_api)(const struct device *dev, const u16_t x,
- const u16_t y,
- const struct display_buffer_descriptor *desc,
- void *buf);
-
-/**
- * @typedef display_get_framebuffer_api
- * @brief Callback API to get framebuffer pointer
- * See display_get_framebuffer() for argument description
- */
-typedef void *(*display_get_framebuffer_api)(const struct device *dev);
-
-/**
- * @typedef display_set_brightness_api
- * @brief Callback API to set display brightness
- * See display_set_brightness() for argument description
- */
-typedef int (*display_set_brightness_api)(const struct device *dev,
- const u8_t brightness);
-
-/**
- * @typedef display_set_contrast_api
- * @brief Callback API to set display contrast
- * See display_set_contrast() for argument description
- */
-typedef int (*display_set_contrast_api)(const struct device *dev,
- const u8_t contrast);
-
-/**
- * @typedef display_get_capabilities_api
- * @brief Callback API to get display capabilities
- * See display_get_capabilities() for argument description
- */
-typedef void (*display_get_capabilities_api)(
- const struct device *dev, struct display_capabilities *capabilities);
-
-/**
- * @typedef display_set_pixel_format_api
- * @brief Callback API to set pixel format used by the display
- * See display_set_pixel_format() for argument description
- */
-typedef int (*display_set_pixel_format_api)(
- const struct device *dev, const enum display_pixel_format pixel_format);
-
-/**
- * @typedef display_set_orientation_api
- * @brief Callback API to set orientation used by the display
- * See display_set_orientation() for argument description
- */
-typedef int (*display_set_orientation_api)(
- const struct device *dev, const enum display_orientation orientation);
-
-/**
- * @brief Display driver API
- * API which a display driver should expose
- */
-struct display_driver_api {
- display_blanking_on_api blanking_on;
- display_blanking_off_api blanking_off;
- display_write_api write;
- display_read_api read;
- display_get_framebuffer_api get_framebuffer;
- display_set_brightness_api set_brightness;
- display_set_contrast_api set_contrast;
- display_get_capabilities_api get_capabilities;
- display_set_pixel_format_api set_pixel_format;
- display_set_orientation_api set_orientation;
-};
-extern struct ili9340_data ili9340_data1;
-extern struct display_driver_api ili9340_api1;
-/**
- * @brief Write data to display
- *
- * @param dev Pointer to device structure
- * @param x x Coordinate of the upper left corner where to write the buffer
- * @param y y Coordinate of the upper left corner where to write the buffer
- * @param desc Pointer to a structure describing the buffer layout
- * @param buf Pointer to buffer array
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_write(const struct device *dev, const u16_t x, const u16_t y,
- const struct display_buffer_descriptor *desc, const void *buf)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->write(dev, x, y, desc, buf);
-}
-
-/**
- * @brief Read data from display
- *
- * @param dev Pointer to device structure
- * @param x x Coordinate of the upper left corner where to read from
- * @param y y Coordinate of the upper left corner where to read from
- * @param desc Pointer to a structure describing the buffer layout
- * @param buf Pointer to buffer array
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_read(const struct device *dev, const u16_t x, const u16_t y,
- const struct display_buffer_descriptor *desc, void *buf)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->read(dev, x, y, desc, buf);
-}
-
-/**
- * @brief Get pointer to framebuffer for direct access
- *
- * @param dev Pointer to device structure
- *
- * @retval Pointer to frame buffer or NULL if direct framebuffer access
- * is not supported
- *
- */
-static inline void *
-display_get_framebuffer(const struct device *dev)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->get_framebuffer(dev);
-}
-
-/**
- * @brief Turn display blanking on
- *
- * @param dev Pointer to device structure
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_blanking_on(const struct device *dev)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->blanking_on(dev);
-}
-
-/**
- * @brief Turn display blanking off
- *
- * @param dev Pointer to device structure
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_blanking_off(const struct device *dev)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->blanking_off(dev);
-}
-
-/**
- * @brief Set the brightness of the display
- *
- * Set the brightness of the display in steps of 1/256, where 255 is full
- * brightness and 0 is minimal.
- *
- * @param dev Pointer to device structure
- * @param brightness Brightness in steps of 1/256
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_brightness(const struct device *dev, u8_t brightness)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_brightness(dev, brightness);
-}
-
-/**
- * @brief Set the contrast of the display
- *
- * Set the contrast of the display in steps of 1/256, where 255 is maximum
- * difference and 0 is minimal.
- *
- * @param dev Pointer to device structure
- * @param contrast Contrast in steps of 1/256
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_contrast(const struct device *dev, u8_t contrast)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_contrast(dev, contrast);
-}
-
-/**
- * @brief Get display capabilities
- *
- * @param dev Pointer to device structure
- * @param capabilities Pointer to capabilities structure to populate
- */
-static inline void
-display_get_capabilities(const struct device *dev,
- struct display_capabilities *capabilities)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- api->get_capabilities(dev, capabilities);
-}
-
-/**
- * @brief Set pixel format used by the display
- *
- * @param dev Pointer to device structure
- * @param pixel_format Pixel format to be used by display
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_pixel_format(const struct device *dev,
- const enum display_pixel_format pixel_format)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_pixel_format(dev, pixel_format);
-}
-
-/**
- * @brief Set display orientation
- *
- * @param dev Pointer to device structure
- * @param orientation Orientation to be used by display
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_orientation(const struct device *dev,
- const enum display_orientation orientation)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_orientation(dev, orientation);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-
-#endif /* ZEPHYR_INCLUDE_DISPLAY_H_*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.c
deleted file mode 100644
index 6dd8a330a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "display_ili9340.h"
-#include <display.h>
-
-//#define LOG_LEVEL CONFIG_DISPLAY_LOG_LEVEL
-//#include <logging/log.h>
-// LOG_MODULE_REGISTER(display_ili9340);
-#define LOG_ERR printf
-#define LOG_DBG printf
-#define LOG_WRN printf
-
-#include <drivers/gpio.h>
-#include <sys/byteorder.h>
-#include <drivers/spi.h>
-#include <string.h>
-#include <stdio.h>
-
-struct ili9340_data {
- struct device *reset_gpio;
- struct device *command_data_gpio;
- struct device *spi_dev;
- struct spi_config spi_config;
-#ifdef DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER
- struct spi_cs_control cs_ctrl;
-#endif
-};
-
-struct ili9340_data ili9340_data1;
-
-#define ILI9340_CMD_DATA_PIN_COMMAND 0
-#define ILI9340_CMD_DATA_PIN_DATA 1
-
-static void
-ili9340_exit_sleep(struct ili9340_data *data)
-{
- ili9340_transmit(data, ILI9340_CMD_EXIT_SLEEP, NULL, 0);
- // k_sleep(Z_TIMEOUT_MS(120));
-}
-
-int
-ili9340_init()
-{
- struct ili9340_data *data = &ili9340_data1;
- printf("Initializing display driver\n");
- data->spi_dev = device_get_binding(DT_ILITEK_ILI9340_0_BUS_NAME);
- if (data->spi_dev == NULL) {
- return -EPERM;
- }
- data->spi_config.frequency = DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY;
- data->spi_config.operation =
- SPI_OP_MODE_MASTER
- | SPI_WORD_SET(8); // SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
- data->spi_config.slave = DT_ILITEK_ILI9340_0_BASE_ADDRESS;
-
-#ifdef DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER
- data->cs_ctrl.gpio_dev =
- device_get_binding(DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER);
- data->cs_ctrl.gpio_pin = DT_ILITEK_ILI9340_0_CS_GPIO_PIN;
- data->cs_ctrl.delay = 0;
- data->spi_config.cs = &(data->cs_ctrl);
-#else
- data->spi_config.cs = NULL;
-#endif
- data->reset_gpio =
- device_get_binding(DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER);
- if (data->reset_gpio == NULL) {
- return -EPERM;
- }
-
- gpio_pin_configure(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN,
- GPIO_OUTPUT);
-
- data->command_data_gpio =
- device_get_binding(DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER);
- if (data->command_data_gpio == NULL) {
- return -EPERM;
- }
-
- gpio_pin_configure(data->command_data_gpio,
- DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN, GPIO_OUTPUT);
-
- LOG_DBG("Resetting display driver\n");
- gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
- k_sleep(Z_TIMEOUT_MS(1));
- gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
- k_sleep(Z_TIMEOUT_MS(1));
- gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
- k_sleep(Z_TIMEOUT_MS(5));
-
- LOG_DBG("Initializing LCD\n");
- ili9340_lcd_init(data);
-
- LOG_DBG("Exiting sleep mode\n");
- ili9340_exit_sleep(data);
-
- return 0;
-}
-
-static void
-ili9340_set_mem_area(struct ili9340_data *data, const u16_t x, const u16_t y,
- const u16_t w, const u16_t h)
-{
- u16_t spi_data[2];
-
- spi_data[0] = sys_cpu_to_be16(x);
- spi_data[1] = sys_cpu_to_be16(x + w - 1);
- ili9340_transmit(data, ILI9340_CMD_COLUMN_ADDR, &spi_data[0], 4);
-
- spi_data[0] = sys_cpu_to_be16(y);
- spi_data[1] = sys_cpu_to_be16(y + h - 1);
- ili9340_transmit(data, ILI9340_CMD_PAGE_ADDR, &spi_data[0], 4);
-}
-
-static int
-ili9340_write(const struct device *dev, const u16_t x, const u16_t y,
- const struct display_buffer_descriptor *desc, const void *buf)
-{
- struct ili9340_data *data = (struct ili9340_data *)&ili9340_data1;
- const u8_t *write_data_start = (u8_t *)buf;
- struct spi_buf tx_buf;
- struct spi_buf_set tx_bufs;
- u16_t write_cnt;
- u16_t nbr_of_writes;
- u16_t write_h;
-
- __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
- __ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size,
- "Input buffer to small");
- ili9340_set_mem_area(data, x, y, desc->width, desc->height);
-
- if (desc->pitch > desc->width) {
- write_h = 1U;
- nbr_of_writes = desc->height;
- }
- else {
- write_h = desc->height;
- nbr_of_writes = 1U;
- }
- ili9340_transmit(data, ILI9340_CMD_MEM_WRITE, (void *)write_data_start,
- 3 * desc->width * write_h);
-
- tx_bufs.buffers = &tx_buf;
- tx_bufs.count = 1;
-
- write_data_start += (3 * desc->pitch);
- for (write_cnt = 1U; write_cnt < nbr_of_writes; ++write_cnt) {
- tx_buf.buf = (void *)write_data_start;
- tx_buf.len = 3 * desc->width * write_h;
- spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
- write_data_start += (3 * desc->pitch);
- }
-
- return 0;
-}
-
-static int
-ili9340_read(const struct device *dev, const u16_t x, const u16_t y,
- const struct display_buffer_descriptor *desc, void *buf)
-{
- LOG_ERR("Reading not supported\n");
- return -ENOTSUP;
-}
-
-static void *
-ili9340_get_framebuffer(const struct device *dev)
-{
- LOG_ERR("Direct framebuffer access not supported\n");
- return NULL;
-}
-
-static int
-ili9340_display_blanking_off(const struct device *dev)
-{
- struct ili9340_data *data = (struct ili9340_data *)dev->driver_data;
-
- LOG_DBG("Turning display blanking off\n");
- ili9340_transmit(data, ILI9340_CMD_DISPLAY_ON, NULL, 0);
- return 0;
-}
-
-static int
-ili9340_display_blanking_on(const struct device *dev)
-{
- struct ili9340_data *data = (struct ili9340_data *)dev->driver_data;
-
- LOG_DBG("Turning display blanking on\n");
- ili9340_transmit(data, ILI9340_CMD_DISPLAY_OFF, NULL, 0);
- return 0;
-}
-
-static int
-ili9340_set_brightness(const struct device *dev, const u8_t brightness)
-{
- LOG_WRN("Set brightness not implemented\n");
- return -ENOTSUP;
-}
-
-static int
-ili9340_set_contrast(const struct device *dev, const u8_t contrast)
-{
- LOG_ERR("Set contrast not supported\n");
- return -ENOTSUP;
-}
-
-static int
-ili9340_set_pixel_format(const struct device *dev,
- const enum display_pixel_format pixel_format)
-{
- if (pixel_format == PIXEL_FORMAT_RGB_888) {
- return 0;
- }
- LOG_ERR("Pixel format change not implemented\n");
- return -ENOTSUP;
-}
-
-static int
-ili9340_set_orientation(const struct device *dev,
- const enum display_orientation orientation)
-{
- if (orientation == DISPLAY_ORIENTATION_NORMAL) {
- return 0;
- }
- LOG_ERR("Changing display orientation not implemented\n");
- return -ENOTSUP;
-}
-
-static void
-ili9340_get_capabilities(const struct device *dev,
- struct display_capabilities *capabilities)
-{
- memset(capabilities, 0, sizeof(struct display_capabilities));
- capabilities->x_resolution = 320;
- capabilities->y_resolution = 240;
- capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_888;
- capabilities->current_pixel_format = PIXEL_FORMAT_RGB_888;
- capabilities->current_orientation = DISPLAY_ORIENTATION_NORMAL;
-}
-
-void
-ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
- size_t tx_len)
-{
- data = (struct ili9340_data *)&ili9340_data1;
- struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
- struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
-
- gpio_pin_set(data->command_data_gpio,
- DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
- ILI9340_CMD_DATA_PIN_COMMAND);
- spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
- if (tx_data != NULL) {
- tx_buf.buf = tx_data;
- tx_buf.len = tx_len;
- gpio_pin_set(data->command_data_gpio,
- DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
- ILI9340_CMD_DATA_PIN_DATA);
- spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
- }
-}
-
-struct display_driver_api ili9340_api1 = {
- .blanking_on = ili9340_display_blanking_on,
- .blanking_off = ili9340_display_blanking_off,
- .write = ili9340_write,
- .read = ili9340_read,
- .get_framebuffer = ili9340_get_framebuffer,
- .set_brightness = ili9340_set_brightness,
- .set_contrast = ili9340_set_contrast,
- .get_capabilities = ili9340_get_capabilities,
- .set_pixel_format = ili9340_set_pixel_format,
- .set_orientation = ili9340_set_orientation
-};
-
-/*
- DEVICE_AND_API_INIT(ili9340, DT_ILITEK_ILI9340_0_LABEL, &ili9340_init,
- &ili9340_data, NULL, APPLICATION,
- CONFIG_APPLICATION_INIT_PRIORITY, &ili9340_api);
- */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h
deleted file mode 100644
index f72279d69..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-#ifndef ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_
-#define ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_
-#include "board_config.h"
-#include <autoconf.h>
-#include <zephyr.h>
-
-#define ILI9340_CMD_ENTER_SLEEP 0x10
-#define ILI9340_CMD_EXIT_SLEEP 0x11
-#define ILI9340_CMD_GAMMA_SET 0x26
-#define ILI9340_CMD_DISPLAY_OFF 0x28
-#define ILI9340_CMD_DISPLAY_ON 0x29
-#define ILI9340_CMD_COLUMN_ADDR 0x2a
-#define ILI9340_CMD_PAGE_ADDR 0x2b
-#define ILI9340_CMD_MEM_WRITE 0x2c
-#define ILI9340_CMD_MEM_ACCESS_CTRL 0x36
-#define ILI9340_CMD_PIXEL_FORMAT_SET 0x3A
-#define ILI9340_CMD_FRAME_CTRL_NORMAL_MODE 0xB1
-#define ILI9340_CMD_DISPLAY_FUNCTION_CTRL 0xB6
-#define ILI9340_CMD_POWER_CTRL_1 0xC0
-#define ILI9340_CMD_POWER_CTRL_2 0xC1
-#define ILI9340_CMD_VCOM_CTRL_1 0xC5
-#define ILI9340_CMD_VCOM_CTRL_2 0xC7
-#define ILI9340_CMD_POSITVE_GAMMA_CORRECTION 0xE0
-#define ILI9340_CMD_NEGATIVE_GAMMA_CORRECTION 0xE1
-
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MY 0x80
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MX 0x40
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MV 0x20
-#define ILI9340_DATA_MEM_ACCESS_CTRL_ML 0x10
-#define ILI9340_DATA_MEM_ACCESS_CTRL_BGR 0x08
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MH 0x04
-
-#define ILI9340_DATA_PIXEL_FORMAT_RGB_18_BIT 0x60
-#define ILI9340_DATA_PIXEL_FORMAT_RGB_16_BIT 0x50
-#define ILI9340_DATA_PIXEL_FORMAT_MCU_18_BIT 0x06
-#define ILI9340_DATA_PIXEL_FORMAT_MCU_16_BIT 0x05
-
-struct ili9340_data;
-
-/**
- * Send data to ILI9340 display controller
- *
- * @param data Device data structure
- * @param cmd Command to send to display controller
- * @param tx_data Data to transmit to the display controller
- * In case no data should be transmitted pass a NULL pointer
- * @param tx_len Number of bytes in tx_data buffer
- *
- */
-void
-ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
- size_t tx_len);
-
-/**
- * Perform LCD specific initialization
- *
- * @param data Device data structure
- */
-void
-ili9340_lcd_init(struct ili9340_data *data);
-
-#define DT_ILITEK_ILI9340_0_LABEL "DISPLAY"
-#define CONFIG_DISPLAY_LOG_LEVEL 0
-
-#endif /* ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340_adafruit_1480.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340_adafruit_1480.c
deleted file mode 100644
index 1077a87f1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340_adafruit_1480.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "display_ili9340.h"
-
-void
-ili9340_lcd_init(struct ili9340_data *data)
-{
- u8_t tx_data[15];
-
- tx_data[0] = 0x23;
- ili9340_transmit(data, ILI9340_CMD_POWER_CTRL_1, tx_data, 1);
-
- tx_data[0] = 0x10;
- ili9340_transmit(data, ILI9340_CMD_POWER_CTRL_2, tx_data, 1);
-
- tx_data[0] = 0x3e;
- tx_data[1] = 0x28;
- ili9340_transmit(data, ILI9340_CMD_VCOM_CTRL_1, tx_data, 2);
-
- tx_data[0] = 0x86;
- ili9340_transmit(data, ILI9340_CMD_VCOM_CTRL_2, tx_data, 1);
-
- tx_data[0] =
- ILI9340_DATA_MEM_ACCESS_CTRL_MV | ILI9340_DATA_MEM_ACCESS_CTRL_BGR;
- ili9340_transmit(data, ILI9340_CMD_MEM_ACCESS_CTRL, tx_data, 1);
-
- tx_data[0] = ILI9340_DATA_PIXEL_FORMAT_MCU_18_BIT
- | ILI9340_DATA_PIXEL_FORMAT_RGB_18_BIT;
- ili9340_transmit(data, ILI9340_CMD_PIXEL_FORMAT_SET, tx_data, 1);
-
- tx_data[0] = 0x00;
- tx_data[1] = 0x18;
- ili9340_transmit(data, ILI9340_CMD_FRAME_CTRL_NORMAL_MODE, tx_data, 2);
-
- tx_data[0] = 0x08;
- tx_data[1] = 0x82;
- tx_data[2] = 0x27;
- ili9340_transmit(data, ILI9340_CMD_DISPLAY_FUNCTION_CTRL, tx_data, 3);
-
- tx_data[0] = 0x01;
- ili9340_transmit(data, ILI9340_CMD_GAMMA_SET, tx_data, 1);
-
- tx_data[0] = 0x0F;
- tx_data[1] = 0x31;
- tx_data[2] = 0x2B;
- tx_data[3] = 0x0C;
- tx_data[4] = 0x0E;
- tx_data[5] = 0x08;
- tx_data[6] = 0x4E;
- tx_data[7] = 0xF1;
- tx_data[8] = 0x37;
- tx_data[9] = 0x07;
- tx_data[10] = 0x10;
- tx_data[11] = 0x03;
- tx_data[12] = 0x0E;
- tx_data[13] = 0x09;
- tx_data[14] = 0x00;
- ili9340_transmit(data, ILI9340_CMD_POSITVE_GAMMA_CORRECTION, tx_data, 15);
-
- tx_data[0] = 0x00;
- tx_data[1] = 0x0E;
- tx_data[2] = 0x14;
- tx_data[3] = 0x03;
- tx_data[4] = 0x11;
- tx_data[5] = 0x07;
- tx_data[6] = 0x31;
- tx_data[7] = 0xC1;
- tx_data[8] = 0x48;
- tx_data[9] = 0x08;
- tx_data[10] = 0x0F;
- tx_data[11] = 0x0C;
- tx_data[12] = 0x31;
- tx_data[13] = 0x36;
- tx_data[14] = 0x0F;
- ili9340_transmit(data, ILI9340_CMD_NEGATIVE_GAMMA_CORRECTION, tx_data, 15);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c
deleted file mode 100644
index 6a88f8007..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include "bh_platform.h"
-#include "runtime_lib.h"
-#include "native_interface.h"
-#include "app_manager_export.h"
-#include "board_config.h"
-#include "bh_common.h"
-#include "bh_queue.h"
-#include "runtime_sensor.h"
-#include "bi-inc/attr_container.h"
-#include "module_wasm_app.h"
-#include "wasm_export.h"
-#include "display.h"
-#include "lvgl.h"
-
-extern bool
-init_sensor_framework();
-extern void
-exit_sensor_framework();
-extern int
-aee_host_msg_callback(void *msg, uint32_t msg_len);
-extern bool
-touchscreen_read(lv_indev_data_t *data);
-extern int
-ili9340_init();
-extern void
-xpt2046_init(void);
-extern void
-wgl_init();
-
-#include <zephyr.h>
-#include <drivers/uart.h>
-#include <device.h>
-
-int uart_char_cnt = 0;
-
-static void
-uart_irq_callback(struct device *dev)
-{
- unsigned char ch;
-
- while (uart_poll_in(dev, &ch) == 0) {
- uart_char_cnt++;
- aee_host_msg_callback(&ch, 1);
- }
-}
-
-struct device *uart_dev = NULL;
-
-static bool
-host_init()
-{
- uart_dev = device_get_binding(HOST_DEVICE_COMM_UART_NAME);
- if (!uart_dev) {
- printf("UART: Device driver not found.\n");
- return false;
- }
- uart_irq_rx_enable(uart_dev);
- uart_irq_callback_set(uart_dev, uart_irq_callback);
- return true;
-}
-
-int
-host_send(void *ctx, const char *buf, int size)
-{
- if (!uart_dev)
- return 0;
-
- for (int i = 0; i < size; i++)
- uart_poll_out(uart_dev, buf[i]);
-
- return size;
-}
-
-void
-host_destroy()
-{}
-
-/* clang-format off */
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-/* clang-format on */
-
-timer_ctx_t timer_ctx;
-
-static char global_heap_buf[270 * 1024] = { 0 };
-
-static uint8_t color_copy[320 * 10 * 3];
-
-static void
-display_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color)
-{
- u16_t w = area->x2 - area->x1 + 1;
- u16_t h = area->y2 - area->y1 + 1;
- struct display_buffer_descriptor desc;
- int i;
- uint8_t *color_p = color_copy;
-
- desc.buf_size = 3 * w * h;
- desc.width = w;
- desc.pitch = w;
- desc.height = h;
-
- for (i = 0; i < w * h; i++, color++) {
- color_p[i * 3] = color->ch.red;
- color_p[i * 3 + 1] = color->ch.green;
- color_p[i * 3 + 2] = color->ch.blue;
- }
-
- display_write(NULL, area->x1, area->y1, &desc, (void *)color_p);
-
- lv_disp_flush_ready(disp_drv); /* in v5.3 is lv_flush_ready */
-}
-
-static bool
-display_input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
-{
- return touchscreen_read(data);
-}
-
-/**
- * Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics
- * library
- */
-static void
-hal_init(void)
-{
- xpt2046_init();
- ili9340_init();
- display_blanking_off(NULL);
-
- /*Create a display buffer*/
- static lv_disp_buf_t disp_buf1;
- static lv_color_t buf1_1[320 * 10];
- lv_disp_buf_init(&disp_buf1, buf1_1, NULL, 320 * 10);
-
- /*Create a display*/
- lv_disp_drv_t disp_drv;
- lv_disp_drv_init(&disp_drv); /*Basic initialization*/
- disp_drv.buffer = &disp_buf1;
- disp_drv.flush_cb = display_flush;
- // disp_drv.hor_res = 200;
- // disp_drv.ver_res = 100;
- lv_disp_drv_register(&disp_drv);
-
- lv_indev_drv_t indev_drv;
- lv_indev_drv_init(&indev_drv); /*Basic initialization*/
- indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read_cb = display_input_read;
- lv_indev_drv_register(&indev_drv);
-}
-
-int
-iwasm_main()
-{
- RuntimeInitArgs init_args;
- host_init();
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- wgl_init();
- hal_init();
-
- /* timer manager */
- if (!init_wasm_timer()) {
- goto fail;
- }
-
- app_manager_startup(&interface);
-
-fail:
- wasm_runtime_destroy();
- return -1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/main.c
deleted file mode 100644
index e6254e5b9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/main.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "bh_platform.h"
-#include "bh_assert.h"
-#include "bh_log.h"
-#include "wasm_export.h"
-
-extern int
-iwasm_main();
-
-void
-main(void)
-{
- iwasm_main();
- for (;;) {
- k_sleep(Z_TIMEOUT_MS(1000));
- }
-}
-
-int
-time_get_ms()
-{
- return k_uptime_get_32();
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_jlf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_jlf.h
deleted file mode 100644
index bb20ecbb8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_jlf.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __PIN_CONFIG_JLF_H__
-#define __PIN_CONFIG_JLF_H__
-
-#define DT_ILITEK_ILI9340_0_BUS_NAME "SPI_2"
-#define DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY 10 * 1000
-
-#define DT_ILITEK_ILI9340_0_BASE_ADDRESS 1
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER "GPIO_0"
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN 5
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER "GPIO_0"
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN 4
-
-#define XPT2046_SPI_DEVICE_NAME "SPI_2"
-#define XPT2046_SPI_MAX_FREQUENCY 10 * 1000
-#define XPT2046_CS_GPIO_CONTROLLER "GPIO_0"
-#define XPT2046_CS_GPIO_PIN 6
-
-#define XPT2046_PEN_GPIO_CONTROLLER "GPIO_0"
-#define XPT2046_PEN_GPIO_PIN 7
-
-#define HOST_DEVICE_COMM_UART_NAME "UART_1"
-#endif /* __PIN_CONFIG_JLF_H__ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_stm32.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_stm32.h
deleted file mode 100644
index 523ce2308..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/gui/wasm-runtime-wgl/src/platform/zephyr/pin_config_stm32.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __PIN_CONFIG_STM32_H__
-#define __PIN_CONFIG_STM32_H__
-
-#define DT_ILITEK_ILI9340_0_BUS_NAME "SPI_1"
-#define DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY 24 * 1000 * 1000
-
-#define DT_ILITEK_ILI9340_0_BASE_ADDRESS 1
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER "GPIOC"
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN 12
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER "GPIOC"
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN 11
-
-#define DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER "GPIOC"
-#define DT_ILITEK_ILI9340_0_CS_GPIO_PIN 10
-
-#define XPT2046_SPI_DEVICE_NAME "SPI_1"
-#define XPT2046_SPI_MAX_FREQUENCY 12 * 1000 * 1000
-#define XPT2046_CS_GPIO_CONTROLLER "GPIOD"
-#define XPT2046_CS_GPIO_PIN 0
-
-#define XPT2046_PEN_GPIO_CONTROLLER "GPIOD"
-#define XPT2046_PEN_GPIO_PIN 1
-
-#define HOST_DEVICE_COMM_UART_NAME "UART_6"
-
-#endif /* __PIN_CONFIG_STM32_H__ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/LICENCE.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/LICENCE.txt
deleted file mode 100644
index beaef1d26..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/LICENCE.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-MIT licence
-Copyright (c) 2016 Gábor Kiss-Vámosi
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/README.md
deleted file mode 100644
index 87fd2bd42..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/README.md
+++ /dev/null
@@ -1,174 +0,0 @@
-"littlevgl" sample introduction
-==============
-This sample demonstrates that a graphic user interface application in WebAssembly by compiling the LittlevGL v5.3, an open-source embedded 2d graphic library into the WASM bytecode.
-
-In this sample, the whole LittlevGL v5.3 source code is built into the WebAssembly code with the user application. The platform interfaces defined by LittlevGL is implemented in the runtime and registered for WASM application through calling wasm_runtime_full_init().
-
-```C
-static NativeSymbol native_symbols[] = {
- EXPORT_WASM_API_WITH_SIG(display_input_read, "(*)i"),
- EXPORT_WASM_API_WITH_SIG(display_flush, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(display_fill, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(display_vdb_write, "(*iii*i)"),
- EXPORT_WASM_API_WITH_SIG(display_map, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(time_get_ms, "()i")
-};
-```
-
-The runtime component supports building target for Linux and Zephyr/STM Nucleo board. The beauty of this sample is the WebAssembly application can have identical display and behavior when running from both runtime environments. That implies we can do majority of application validation from desktop environment as long as two runtime distributions support the same set of application interface.
-
-
-Below pictures show the WASM application is running on an STM board with an LCD touch panel.
-
-![WAMR UI SAMPLE](../../doc/pics/vgl_demo2.png "WAMR UI DEMO STM32")
-
-![WAMR UI SAMPLE](../../doc/pics/vgl_demo_linux.png "WAMR UI DEMO LINUX")
-
-
-The number on top will plus one each second, and the number on the bottom will plus one when clicked. When users click the blue button, the WASM application increases the counter, and the latest counter value is displayed on the top banner of the touch panel.
-
-The sample also provides the native Linux version of application without the runtime under folder "vgl-native-ui-app". It can help to check differences between the implementations in native and WebAssembly.
-
-Test on Linux
-================================
-
-Install required SDK and libraries
---------------
-- 32 bit SDL(simple directmedia layer) (Note: only necessary when `WAMR_BUILD_TARGET` is set to `X86_32` when building WAMR runtime)
-Use apt-get:
- ```bash
- sudo apt-get install libsdl2-dev:i386
- ```
-Or download source from www.libsdl.org:
- ```bash
- ./configure C_FLAGS=-m32 CXX_FLAGS=-m32 LD_FLAGS=-m32
- make
- sudo make install
- ```
-- 64 bit SDL(simple directmedia layer) (Note: only necessary when `WAMR_BUILD_TARGET` is set to `X86_64` when building WAMR runtime)
-Use apt-get:
- ```bash
- sudo apt-get install libsdl2-dev
- ```
-Or download source from www.libsdl.org:
- ```bash
- ./configure
- make
- sudo make install
- ```
-
-Build and Run
---------------
-
-- Build
- ```bash
- ./build.sh
- ```
- All binaries are in "out", which contains "host_tool", "vgl_native_ui_app", "ui_app.wasm" "ui_app_no_wasi.wasm "and "vgl_wasm_runtime".
-- Run the native Linux build of the lvgl sample (no wasm)
- ```bash
- ./vgl_native_ui_app
- ```
-
-- Run WASM VM Linux applicaton & install WASM APP
- First start vgl_wasm_runtime in server mode.
- ```bash
- ./vgl_wasm_runtime -s
- ```
- Then install and uninstall wasm APPs by using host tool.
- ```bash
- ./host_tool -i ui_wasi -f ui_app_wasi.wasm
- ./host_tool -q
- ./host_tool -u ui_wasi
- ./host_tool -i ui_no_wasi -f ui_app_builtin_libc.wasm
- ./host_tool -q
- ./host_tool -u ui_no_wasi
- ```
-
-Test on Zephyr
-================================
-We can use a STM32 NUCLEO_F767ZI board with ILI9341 display and XPT2046 touch screen to run the test. Then use host_tool to remotely install wasm app into STM32.
-- Build WASM VM into Zephyr system
- a. clone zephyr source code
- Refer to [Zephyr getting started](https://docs.zephyrproject.org/latest/getting_started/index.html).
-
- ```bash
- west init zephyrproject
- cd zephyrproject/zephyr
- git checkout zephyr-v2.3.0
- cd ..
- west update
- ```
-
- b. copy samples
- ```bash
- cd zephyr/samples/
- cp -a <wamr_root>/samples/littlevgl/vgl-wasm-runtime vgl-wasm-runtime
- cd vgl-wasm-runtime/zephyr_build
- ```
- c. create a link to wamr root dir
- ```bash
- ln -s <wamr_root> wamr
- ```
-
-d. build source code
- Since ui_app incorporated LittlevGL source code, so it needs more RAM on the device to install the application. It is recommended that RAM SIZE not less than 380KB. In our test use nucleo_f767zi, which is supported by Zephyr. Since the littlevgl wasm app is quite big (~100KB in wasm format and ~200KB in AOT format ), there isn't enough SRAM to build interpreter and AOT together. You can only choose one of them:
-
- - Interpreter
- ```bash
- mkdir build && cd build
- source ../../../../zephyr-env.sh
- cmake -GNinja -DBOARD=nucleo_f767zi -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_AOT=0 ..
- ninja flash
- ```
-
- - AOT
- ```bash
- mkdir build && cd build
- source ../../../../zephyr-env.sh
- cmake -GNinja -DBOARD=nucleo_f767zi -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_AOT=1 ..
- ninja flash
- ```
-
-- Hardware Connections
-
-```
-+-------------------+-+------------------+
-|NUCLEO-F767ZI | ILI9341 Display |
-+-------------------+-+------------------+
-| CN7.10 | CLK |
-+-------------------+-+------------------+
-| CN7.12 | MISO |
-+-------------------+-+------------------+
-| CN7.14 | MOSI |
-+-------------------+-+------------------+
-| CN11.1 | CS1 for ILI9341 |
-+-------------------+-+------------------+
-| CN11.2 | D/C |
-+-------------------+-+------------------+
-| CN11.3 | RESET |
-+-------------------+-+------------------+
-| CN9.25 | PEN interrupt |
-+-------------------+-+------------------+
-| CN9.27 | CS2 for XPT2046 |
-+-------------------+-+------------------+
-| CN10.14 | PC UART RX |
-+-------------------+-+------------------+
-| CN11.16 | PC UART RX |
-+-------------------+-+------------------+
-```
-
-- Install WASM application to Zephyr using host_tool
-First, connect PC and STM32 with UART. Then install to use host_tool.
- ```bash
- sudo ./host_tool -D /dev/ttyUSBXXX -i ui_app -f ui_app_builtin_libc.wasm
- # /dev/ttyUSBXXX is the UART device, e.g. /dev/ttyUSB0
- ```
-**Note**: WASI is unavailable on zephyr currently, so you have to use the ui_app_builtin_libc.wasm which doesn't depend on WASI.
-
-- Install AOT version WASM application
- ```bash
- wamrc --target=thumbv7 --target-abi=eabi --cpu=cortex-m7 -o ui_app_no_wasi.aot ui_app_builtin_libc.wasm
- ./host_tool -D /dev/ttyUSBXXX -i ui_app -f ui_app_no_wasi.aot
- ```
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/build.sh
deleted file mode 100755
index 81f2e67f4..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/build.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-PROJECT_DIR=$PWD
-WAMR_DIR=${PWD}/../..
-OUT_DIR=${PWD}/out
-BUILD_DIR=${PWD}/build
-LV_CFG_PATH=${PROJECT_DIR}/lv_config
-
-
-
-if [ -z $KW_BUILD ] || [ -z $KW_OUT_FILE ];then
- echo "Local Build Env"
- cmakewrap="cmake"
- makewrap="make"
-else
- echo "Klocwork Build Env"
- cmakewrap="cmake -DCMAKE_BUILD_TYPE=Debug"
- makewrap="kwinject -o $KW_OUT_FILE make"
-fi
-
-if [ ! -d $BUILD_DIR ]; then
- mkdir ${BUILD_DIR}
-fi
-
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-
-
-cd ${BUILD_DIR}
-if [ ! -d "lvgl" ]; then
- echo "starting download lvgl for v5.3 ..."
- git clone https://github.com/lvgl/lvgl.git --branch v5.3
- if [ $? != 0 ];then
- echo "download lvgl repo failed: $?\n"
- exit 2
- fi
-fi
-
-echo "##################### 0. build wamr-sdk littlevgl start#####################"
-cd ${WAMR_DIR}/wamr-sdk
-./build_sdk.sh -n littlevgl -x ${PROJECT_DIR}/wamr_config_littlevgl.cmake -e ${LV_CFG_PATH} -c
-[ $? -eq 0 ] || exit $?
-echo "#####################build wamr-sdk littlevgl success"
-
-echo -e "\n\n"
-echo "##################### 1. build native-ui-app start#####################"
-cd $BUILD_DIR
-mkdir -p vgl-native-ui-app
-cd vgl-native-ui-app
-$cmakewrap ${PROJECT_DIR}/vgl-native-ui-app
-$makewrap
-if [ $? != 0 ];then
- echo "BUILD_FAIL native-ui-app $?\n"
- exit 2
-fi
-echo $PWD
-cp vgl_native_ui_app ${OUT_DIR}
-echo "#####################build native-ui-app success"
-
-echo -e "\n\n"
-echo "##################### 2. build littlevgl wasm runtime start#####################"
-cd $BUILD_DIR
-mkdir -p vgl-wasm-runtime
-cd vgl-wasm-runtime
-$cmakewrap ${PROJECT_DIR}/vgl-wasm-runtime
-$makewrap
-[ $? -eq 0 ] || exit $?
-cp vgl_wasm_runtime ${OUT_DIR}/
-
-echo "##################### build littlevgl wasm runtime end#####################"
-
-echo -e "\n\n"
-echo "#####################build host-tool"
-cd $BUILD_DIR
-mkdir -p host-tool
-cd host-tool
-$cmakewrap ${WAMR_DIR}/test-tools/host-tool
-$makewrap
-if [ $? != 0 ];then
- echo "BUILD_FAIL host tool exit as $?\n"
- exit 2
-fi
-cp host_tool ${OUT_DIR}
-echo "#####################build host-tool success"
-
-echo -e "\n\n"
-echo "##################### 3. build wasm ui app start#####################"
-cd ${PROJECT_DIR}/wasm-apps
-if [ ! -d "${PROJECT_DIR}/wasm-apps/lvgl" ]; then
- if [ -d "$BUILD_DIR/vgl-native-ui-app/lvgl" ]; then
- cp -fr $BUILD_DIR/vgl-native-ui-app/lvgl ${PROJECT_DIR}/wasm-apps
- fi
-fi
-./build_wasm_app.sh
-mv *.wasm ${OUT_DIR}/
-
-echo "##################### build wasm ui app end#####################"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_conf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_conf.h
deleted file mode 100644
index 76533a8e1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_conf.h
+++ /dev/null
@@ -1,389 +0,0 @@
-/**
- * @file lv_conf.h
- *
- */
-
-#if 1 /*Set it to "1" to enable content*/
-
-#ifndef LV_CONF_H
-#define LV_CONF_H
-/*===================
- Dynamic memory
- *===================*/
-
-/* Memory size which will be used by the library
- * to store the graphical objects and other data */
-#define LV_MEM_CUSTOM 1 /*1: use custom malloc/free, 0: use the built-in lv_mem_alloc/lv_mem_free*/
-#if LV_MEM_CUSTOM == 0
-# define LV_MEM_SIZE (64U * 1024U) /*Size memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
-# define LV_MEM_ATTR /*Complier prefix for big array declaration*/
-# define LV_MEM_ADR 0 /*Set an address for memory pool instead of allocation it as an array. Can be in external SRAM too.*/
-# define LV_MEM_AUTO_DEFRAG 1 /*Automatically defrag on free*/
-#else /*LV_MEM_CUSTOM*/
-# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
-# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
-# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
-#endif /*LV_MEM_CUSTOM*/
-
-/* Garbage Collector settings
- * Used if lvgl is binded to higher language and the memory is managed by that language */
-#define LV_ENABLE_GC 0
-#if LV_ENABLE_GC != 0
-# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
-# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
-# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
-#endif /* LV_ENABLE_GC */
-
-/*===================
- Graphical settings
- *===================*/
-
-/* Horizontal and vertical resolution of the library.*/
-#define LV_HOR_RES (320)
-#define LV_VER_RES (240)
-
-/* Dot Per Inch: used to initialize default sizes. E.g. a button with width = LV_DPI / 2 -> half inch wide
- * (Not so important, you can adjust it to modify default sizes and spaces)*/
-#define LV_DPI 100
-
-/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
-#define LV_ANTIALIAS 0 /*1: Enable anti-aliasing*/
-
-/*Screen refresh period in milliseconds*/
-#define LV_REFR_PERIOD 30
-
-/*-----------------
- * VDB settings
- *----------------*/
-
-/* VDB (Virtual Display Buffer) is an internal graphics buffer.
- * The GUI will be drawn into this buffer first and then
- * the buffer will be passed to your `disp_drv.disp_flush` function to
- * copy it to your frame buffer.
- * VDB is required for: buffered drawing, opacity, anti-aliasing and shadows
- * Learn more: https://docs.littlevgl.com/#Drawing*/
-
-/* Size of the VDB in pixels. Typical size: ~1/10 screen. Must be >= LV_HOR_RES
- * Setting it to 0 will disable VDB and `disp_drv.disp_fill` and `disp_drv.disp_map` functions
- * will be called to draw to the frame buffer directly*/
-#define LV_VDB_SIZE ((LV_VER_RES * LV_HOR_RES) / 10)
-
-/* Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays.
- * Special formats are handled with `disp_drv.vdb_wr`)*/
-#define LV_VDB_PX_BPP LV_COLOR_SIZE /*LV_COLOR_SIZE comes from LV_COLOR_DEPTH below to set 8, 16 or 32 bit pixel size automatically */
-
-/* Place VDB to a specific address (e.g. in external RAM)
- * 0: allocate automatically into RAM
- * LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/
-#define LV_VDB_ADR 0
-
-/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing
- * The flushing should use DMA to write the frame buffer in the background */
-#define LV_VDB_DOUBLE 0
-
-/* Place VDB2 to a specific address (e.g. in external RAM)
- * 0: allocate automatically into RAM
- * LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/
-#define LV_VDB2_ADR 0
-
-/* Using true double buffering in `disp_drv.disp_flush` you will always get the image of the whole screen.
- * Your only task is to set the rendered image (`color_p` parameter) as frame buffer address or send it to your display.
- * The best if you do in the blank period of you display to avoid tearing effect.
- * Requires:
- * - LV_VDB_SIZE = LV_HOR_RES * LV_VER_RES
- * - LV_VDB_DOUBLE = 1
- */
-#define LV_VDB_TRUE_DOUBLE_BUFFERED 0
-
-/*=================
- Misc. setting
- *=================*/
-
-/*Input device settings*/
-#define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/
-#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/
-#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */
-#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
-#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
-#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
-
-/*Color settings*/
-#define LV_COLOR_DEPTH 32 /*Color depth: 1/8/16/32*/
-#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
-#define LV_COLOR_SCREEN_TRANSP 0 /*1: Enable screen transparency. Useful for OSD or other overlapping GUIs. Requires ARGB8888 colors*/
-#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma keying)*/
-
-/*Text settings*/
-#define LV_TXT_UTF8 1 /*Enable UTF-8 coded Unicode character usage */
-#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/
-#define LV_TXT_LINE_BREAK_LONG_LEN 12 /* If a character is at least this long, will break wherever "prettiest" */
-#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 /* Minimum number of characters of a word to put on a line before a break */
-#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 1 /* Minimum number of characters of a word to put on a line after a break */
-
-/*Feature usage*/
-#define USE_LV_ANIMATION 1 /*1: Enable all animations*/
-#define USE_LV_SHADOW 1 /*1: Enable shadows*/
-#define USE_LV_GROUP 1 /*1: Enable object groups (for keyboards)*/
-#define USE_LV_GPU 0 /*1: Enable GPU interface*/
-#define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/
-#define USE_LV_FILESYSTEM 0 /*1: Enable file system (might be required for images*/
-#define USE_LV_MULTI_LANG 0 /* Number of languages for labels to store (0: to disable this feature)*/
-
-/*Compiler settings*/
-#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
-#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */
-#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/
-#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 /* 1: Initialization with non constant values are supported */
-
-/*HAL settings*/
-#define LV_TICK_CUSTOM 1 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */
-#if LV_TICK_CUSTOM == 1
-#define LV_TICK_CUSTOM_INCLUDE "system_header.h" /*Header for the sys time function*/
-#define LV_TICK_CUSTOM_SYS_TIME_EXPR (time_get_ms()) /*Expression evaluating to current systime in ms*/
-#endif /*LV_TICK_CUSTOM*/
-
-/*Log settings*/
-#define USE_LV_LOG 1 /*Enable/disable the log module*/
-#if USE_LV_LOG
-/* How important log should be added:
- * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
- * LV_LOG_LEVEL_INFO Log important events
- * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't caused problem
- * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
- */
-# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
-/* 1: Print the log with 'printf'; 0: user need to register a callback*/
-
-# define LV_LOG_PRINTF 0
-#endif /*USE_LV_LOG*/
-
-/*================
- * THEME USAGE
- *================*/
-#define LV_THEME_LIVE_UPDATE 1 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/
-
-#define USE_LV_THEME_TEMPL 0 /*Just for test*/
-#define USE_LV_THEME_DEFAULT 1 /*Built mainly from the built-in styles. Consumes very few RAM*/
-#define USE_LV_THEME_ALIEN 0 /*Dark futuristic theme*/
-#define USE_LV_THEME_NIGHT 0 /*Dark elegant theme*/
-#define USE_LV_THEME_MONO 0 /*Mono color theme for monochrome displays*/
-#define USE_LV_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/
-#define USE_LV_THEME_ZEN 0 /*Peaceful, mainly light theme */
-#define USE_LV_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/
-
-/*==================
- * FONT USAGE
- *===================*/
-
-/* More info about fonts: https://docs.littlevgl.com/#Fonts
- * To enable a built-in font use 1,2,4 or 8 values
- * which will determine the bit-per-pixel. Higher value means smoother fonts */
-#define USE_LV_FONT_DEJAVU_10 0
-#define USE_LV_FONT_DEJAVU_10_LATIN_SUP 0
-#define USE_LV_FONT_DEJAVU_10_CYRILLIC 0
-#define USE_LV_FONT_SYMBOL_10 0
-
-#define USE_LV_FONT_DEJAVU_20 4
-#define USE_LV_FONT_DEJAVU_20_LATIN_SUP 0
-#define USE_LV_FONT_DEJAVU_20_CYRILLIC 0
-#define USE_LV_FONT_SYMBOL_20 0
-
-#define USE_LV_FONT_DEJAVU_30 0
-#define USE_LV_FONT_DEJAVU_30_LATIN_SUP 0
-#define USE_LV_FONT_DEJAVU_30_CYRILLIC 0
-#define USE_LV_FONT_SYMBOL_30 0
-
-#define USE_LV_FONT_DEJAVU_40 0
-#define USE_LV_FONT_DEJAVU_40_LATIN_SUP 0
-#define USE_LV_FONT_DEJAVU_40_CYRILLIC 0
-#define USE_LV_FONT_SYMBOL_40 0
-
-#define USE_LV_FONT_MONOSPACE_8 1
-
-/* Optionally declare your custom fonts here.
- * You can use these fonts as default font too
- * and they will be available globally. E.g.
- * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
- * LV_FONT_DECLARE(my_font_2) \
- */
-#define LV_FONT_CUSTOM_DECLARE
-
-#define LV_FONT_DEFAULT &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/
-
-/*===================
- * LV_OBJ SETTINGS
- *==================*/
-#define LV_OBJ_FREE_NUM_TYPE uint32_t /*Type of free number attribute (comment out disable free number)*/
-#define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/
-#define LV_OBJ_REALIGN 1 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
-
-/*==================
- * LV OBJ X USAGE
- *================*/
-/*
- * Documentation of the object types: https://docs.littlevgl.com/#Object-types
- */
-
-/*****************
- * Simple object
- *****************/
-
-/*Label (dependencies: -*/
-#define USE_LV_LABEL 1
-#if USE_LV_LABEL != 0
-# define LV_LABEL_SCROLL_SPEED 25 /*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/
-#endif
-
-/*Image (dependencies: lv_label*/
-#define USE_LV_IMG 1
-#if USE_LV_IMG != 0
-# define LV_IMG_CF_INDEXED 1 /*Enable indexed (palette) images*/
-# define LV_IMG_CF_ALPHA 1 /*Enable alpha indexed images*/
-#endif
-
-/*Line (dependencies: -*/
-#define USE_LV_LINE 1
-
-/*Arc (dependencies: -)*/
-#define USE_LV_ARC 1
-
-/*******************
- * Container objects
- *******************/
-
-/*Container (dependencies: -*/
-#define USE_LV_CONT 1
-
-/*Page (dependencies: lv_cont)*/
-#define USE_LV_PAGE 1
-
-/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
-#define USE_LV_WIN 1
-
-/*Tab (dependencies: lv_page, lv_btnm)*/
-#define USE_LV_TABVIEW 1
-# if USE_LV_TABVIEW != 0
-# define LV_TABVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/
-#endif
-
-/*Tileview (dependencies: lv_page) */
-#define USE_LV_TILEVIEW 1
-#if USE_LV_TILEVIEW
-# define LV_TILEVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/
-#endif
-
-/*************************
- * Data visualizer objects
- *************************/
-
-/*Bar (dependencies: -)*/
-#define USE_LV_BAR 1
-
-/*Line meter (dependencies: *;)*/
-#define USE_LV_LMETER 1
-
-/*Gauge (dependencies:lv_bar, lv_lmeter)*/
-#define USE_LV_GAUGE 1
-
-/*Chart (dependencies: -)*/
-#define USE_LV_CHART 1
-
-/*Table (dependencies: lv_label)*/
-#define USE_LV_TABLE 1
-#if USE_LV_TABLE
-# define LV_TABLE_COL_MAX 12
-#endif
-
-/*LED (dependencies: -)*/
-#define USE_LV_LED 1
-
-/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
-#define USE_LV_MBOX 1
-
-/*Text area (dependencies: lv_label, lv_page)*/
-#define USE_LV_TA 1
-#if USE_LV_TA != 0
-# define LV_TA_CURSOR_BLINK_TIME 400 /*ms*/
-# define LV_TA_PWD_SHOW_TIME 1500 /*ms*/
-#endif
-
-/*Spinbox (dependencies: lv_ta)*/
-#define USE_LV_SPINBOX 1
-
-/*Calendar (dependencies: -)*/
-#define USE_LV_CALENDAR 1
-
-/*Preload (dependencies: lv_arc)*/
-#define USE_LV_PRELOAD 1
-#if USE_LV_PRELOAD != 0
-# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
-# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
-# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
-#endif
-
-/*Canvas (dependencies: lv_img)*/
-#define USE_LV_CANVAS 1
-/*************************
- * User input objects
- *************************/
-
-/*Button (dependencies: lv_cont*/
-#define USE_LV_BTN 1
-#if USE_LV_BTN != 0
-# define LV_BTN_INK_EFFECT 1 /*Enable button-state animations - draw a circle on click (dependencies: USE_LV_ANIMATION)*/
-#endif
-
-/*Image Button (dependencies: lv_btn*/
-#define USE_LV_IMGBTN 1
-#if USE_LV_IMGBTN
-# define LV_IMGBTN_TILED 0 /*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
-#endif
-
-/*Button matrix (dependencies: -)*/
-#define USE_LV_BTNM 1
-
-/*Keyboard (dependencies: lv_btnm)*/
-#define USE_LV_KB 1
-
-/*Check box (dependencies: lv_btn, lv_label)*/
-#define USE_LV_CB 1
-
-/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
-#define USE_LV_LIST 1
-#if USE_LV_LIST != 0
-# define LV_LIST_FOCUS_TIME 100 /*Default animation time of focusing to a list element [ms] (0: no animation) */
-#endif
-
-/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
-#define USE_LV_DDLIST 1
-#if USE_LV_DDLIST != 0
-# define LV_DDLIST_ANIM_TIME 200 /*Open and close default animation time [ms] (0: no animation)*/
-#endif
-
-/*Roller (dependencies: lv_ddlist)*/
-#define USE_LV_ROLLER 1
-#if USE_LV_ROLLER != 0
-# define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/
-#endif
-
-/*Slider (dependencies: lv_bar)*/
-#define USE_LV_SLIDER 1
-
-/*Switch (dependencies: lv_slider)*/
-#define USE_LV_SW 1
-
-/*************************
- * Non-user section
- *************************/
-#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
-# define _CRT_SECURE_NO_WARNINGS
-#endif
-
-/*--END OF LV_CONF_H--*/
-
-/*Be sure every define has a default value*/
-#include "lvgl/lv_conf_checker.h"
-
-#endif /*LV_CONF_H*/
-
-#endif /*End of "Content enable"*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_drv_conf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_drv_conf.h
deleted file mode 100644
index d216a3e90..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/lv_config/lv_drv_conf.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/**
- * @file lv_drv_conf.h
- *
- */
-
-/*
- * COPY THIS FILE AS lv_drv_conf.h
- */
-
-#if 1 /*Set it to "1" to enable the content*/
-
-#ifndef LV_DRV_CONF_H
-#define LV_DRV_CONF_H
-
-#include "lv_conf.h"
-
-/*********************
- * DELAY INTERFACE
- *********************/
-#define LV_DRV_DELAY_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_DELAY_US(us) /*delay_us(us)*/ /*Delay the given number of microseconds*/
-#define LV_DRV_DELAY_MS(ms) /*delay_ms(ms)*/ /*Delay the given number of milliseconds*/
-
-/*********************
- * DISPLAY INTERFACE
- *********************/
-
-/*------------
- * Common
- *------------*/
-#define LV_DRV_DISP_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_DISP_CMD_DATA(val) /*pin_x_set(val)*/ /*Set the command/data pin to 'val'*/
-#define LV_DRV_DISP_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
-
-/*---------
- * SPI
- *---------*/
-#define LV_DRV_DISP_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
-#define LV_DRV_DISP_SPI_WR_BYTE(data) /*spi_wr(data)*/ /*Write a byte the SPI bus*/
-#define LV_DRV_DISP_SPI_WR_ARRAY(adr, n) /*spi_wr_mem(adr, n)*/ /*Write 'n' bytes to SPI bus from 'adr'*/
-
-/*------------------
- * Parallel port
- *-----------------*/
-#define LV_DRV_DISP_PAR_CS(val) /*par_cs_set(val)*/ /*Set the Parallel port's Chip select to 'val'*/
-#define LV_DRV_DISP_PAR_SLOW /*par_slow()*/ /*Set low speed on the parallel port*/
-#define LV_DRV_DISP_PAR_FAST /*par_fast()*/ /*Set high speed on the parallel port*/
-#define LV_DRV_DISP_PAR_WR_WORD(data) /*par_wr(data)*/ /*Write a word to the parallel port*/
-#define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/
-
-/***************************
- * INPUT DEVICE INTERFACE
- ***************************/
-
-/*----------
- * Common
- *----------*/
-#define LV_DRV_INDEV_INCLUDE <stdint.h> /*Dummy include by default*/
-#define LV_DRV_INDEV_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
-#define LV_DRV_INDEV_IRQ_READ 0 /*pn_x_read()*/ /*Read the IRQ pin*/
-
-/*---------
- * SPI
- *---------*/
-#define LV_DRV_INDEV_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
-#define LV_DRV_INDEV_SPI_XCHG_BYTE(data) 0 /*spi_xchg(val)*/ /*Write 'val' to SPI and give the read value*/
-
-/*---------
- * I2C
- *---------*/
-#define LV_DRV_INDEV_I2C_START /*i2c_start()*/ /*Make an I2C start*/
-#define LV_DRV_INDEV_I2C_STOP /*i2c_stop()*/ /*Make an I2C stop*/
-#define LV_DRV_INDEV_I2C_RESTART /*i2c_restart()*/ /*Make an I2C restart*/
-#define LV_DRV_INDEV_I2C_WR(data) /*i2c_wr(data)*/ /*Write a byte to the I1C bus*/
-#define LV_DRV_INDEV_I2C_READ(last_read) 0 /*i2c_rd()*/ /*Read a byte from the I2C bud*/
-
-
-/*********************
- * DISPLAY DRIVERS
- *********************/
-
-/*-------------------
- * Monitor of PC
- *-------------------*/
-#ifndef USE_MONITOR
-# define USE_MONITOR 1
-#endif
-
-#if USE_MONITOR
-# define MONITOR_HOR_RES LV_HOR_RES_MAX
-# define MONITOR_VER_RES LV_VER_RES_MAX
-
-/* Scale window by this factor (useful when simulating small screens) */
-# define MONITOR_ZOOM 1
-
-/* Used to test true double buffering with only address changing.
- * Set LV_VDB_SIZE = (LV_HOR_RES * LV_VER_RES) and LV_VDB_DOUBLE = 1 and LV_COLOR_DEPTH = 32" */
-# define MONITOR_DOUBLE_BUFFERED 0
-
-/*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
-# define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h>
-
-/*Different rendering might be used if running in a Virtual machine*/
-# define MONITOR_VIRTUAL_MACHINE 0
-
-/*Open two windows to test multi display support*/
-# define MONITOR_DUAL 0
-#endif
-
-/*-----------------------------------
- * Native Windows (including mouse)
- *----------------------------------*/
-#ifndef USE_WINDOWS
-# define USE_WINDOWS 0
-#endif
-
-#define USE_WINDOWS 0
-#if USE_WINDOWS
-# define WINDOW_HOR_RES 480
-# define WINDOW_VER_RES 320
-#endif
-
-/*----------------
- * SSD1963
- *--------------*/
-#ifndef USE_SSD1963
-# define USE_SSD1963 0
-#endif
-
-#if USE_SSD1963
-# define SSD1963_HOR_RES LV_HOR_RES
-# define SSD1963_VER_RES LV_VER_RES
-# define SSD1963_HT 531
-# define SSD1963_HPS 43
-# define SSD1963_LPS 8
-# define SSD1963_HPW 10
-# define SSD1963_VT 288
-# define SSD1963_VPS 12
-# define SSD1963_FPS 4
-# define SSD1963_VPW 10
-# define SSD1963_HS_NEG 0 /*Negative hsync*/
-# define SSD1963_VS_NEG 0 /*Negative vsync*/
-# define SSD1963_ORI 0 /*0, 90, 180, 270*/
-# define SSD1963_COLOR_DEPTH 16
-#endif
-
-/*----------------
- * R61581
- *--------------*/
-#ifndef USE_R61581
-# define USE_R61581 0
-#endif
-
-#if USE_R61581
-# define R61581_HOR_RES LV_HOR_RES
-# define R61581_VER_RES LV_VER_RES
-# define R61581_HSPL 0 /*HSYNC signal polarity*/
-# define R61581_HSL 10 /*HSYNC length (Not Implemented)*/
-# define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/
-# define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */
-# define R61581_VSPL 0 /*VSYNC signal polarity*/
-# define R61581_VSL 10 /*VSYNC length (Not Implemented)*/
-# define R61581_VFP 8 /*Vertical Front poarch*/
-# define R61581_VBP 8 /*Vertical Back poarch */
-# define R61581_DPL 0 /*DCLK signal polarity*/
-# define R61581_EPL 1 /*ENABLE signal polarity*/
-# define R61581_ORI 0 /*0, 180*/
-# define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/
-#endif
-
-/*------------------------------
- * ST7565 (Monochrome, low res.)
- *-----------------------------*/
-#ifndef USE_ST7565
-# define USE_ST7565 0
-#endif
-
-#if USE_ST7565
-/*No settings*/
-#endif /*USE_ST7565*/
-
-/*-----------------------------------------
- * Linux frame buffer device (/dev/fbx)
- *-----------------------------------------*/
-#ifndef USE_FBDEV
-# define USE_FBDEV 1
-#endif
-
-#if USE_FBDEV
-# define FBDEV_PATH "/dev/fb0"
-#endif
-
-/*********************
- * INPUT DEVICES
- *********************/
-
-/*--------------
- * XPT2046
- *--------------*/
-#ifndef USE_XPT2046
-# define USE_XPT2046 0
-#endif
-
-#if USE_XPT2046
-# define XPT2046_HOR_RES 480
-# define XPT2046_VER_RES 320
-# define XPT2046_X_MIN 200
-# define XPT2046_Y_MIN 200
-# define XPT2046_X_MAX 3800
-# define XPT2046_Y_MAX 3800
-# define XPT2046_AVG 4
-# define XPT2046_INV 0
-#endif
-
-/*-----------------
- * FT5406EE8
- *-----------------*/
-#ifndef USE_FT5406EE8
-# define USE_FT5406EE8 0
-#endif
-
-#if USE_FT5406EE8
-# define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/
-#endif
-
-/*---------------
- * AD TOUCH
- *--------------*/
-#ifndef USE_AD_TOUCH
-# define USE_AD_TOUCH 0
-#endif
-
-#if USE_AD_TOUCH
-/*No settings*/
-#endif
-
-
-/*---------------------------------------
- * Mouse or touchpad on PC (using SDL)
- *-------------------------------------*/
-#ifndef USE_MOUSE
-# define USE_MOUSE 1
-#endif
-
-#if USE_MOUSE
-/*No settings*/
-#endif
-
-/*-------------------------------------------
- * Mousewheel as encoder on PC (using SDL)
- *------------------------------------------*/
-#ifndef USE_MOUSEWHEEL
-# define USE_MOUSEWHEEL 1
-#endif
-
-#if USE_MOUSEWHEEL
-/*No settings*/
-#endif
-
-/*-------------------------------------------------
- * Touchscreen as libinput interface (for Linux based systems)
- *------------------------------------------------*/
-#ifndef USE_LIBINPUT
-# define USE_LIBINPUT 0
-#endif
-
-#if USE_LIBINPUT
-# define LIBINPUT_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
-#endif /*USE_LIBINPUT*/
-
-/*-------------------------------------------------
- * Mouse or touchpad as evdev interface (for Linux based systems)
- *------------------------------------------------*/
-#ifndef USE_EVDEV
-# define USE_EVDEV 0
-#endif
-
-#if USE_EVDEV
-# define EVDEV_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
-# define EVDEV_SWAP_AXES 0 /*Swap the x and y axes of the touchscreen*/
-
-# define EVDEV_SCALE 0 /* Scale input, e.g. if touchscreen resolution does not match display resolution */
-# if EVDEV_SCALE
-# define EVDEV_SCALE_HOR_RES (4096) /* Horizontal resolution of touchscreen */
-# define EVDEV_SCALE_VER_RES (4096) /* Vertical resolution of touchscreen */
-# endif /*EVDEV_SCALE*/
-
-# define EVDEV_CALIBRATE 0 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
-# if EVDEV_CALIBRATE
-# define EVDEV_HOR_MIN 3800 /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
-# define EVDEV_HOR_MAX 200
-# define EVDEV_VER_MIN 200
-# define EVDEV_VER_MAX 3800
-# endif /*EVDEV_SCALE*/
-#endif /*USE_EVDEV*/
-
-/*-------------------------------
- * Keyboard of a PC (using SDL)
- *------------------------------*/
-#ifndef USE_KEYBOARD
-# define USE_KEYBOARD 1
-#endif
-
-#if USE_KEYBOARD
-/*No settings*/
-#endif
-
-#endif /*LV_DRV_CONF_H*/
-
-#endif /*End of "Content enable"*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt
deleted file mode 100644
index 9778e821b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt
+++ /dev/null
@@ -1,137 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 2.9)
-message ("vgl_native_ui_app...")
-project (vgl_native_ui_app)
-
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_NATIVE_LINUX -DUSE_MONITOR -DUSE_MOUSE=1")
-
-# Currently build as 64-bit by default. Set to "NO" to build 32-bit binaries.
-set (BUILD_AS_64BIT_SUPPORT "YES")
-
-if (CMAKE_SIZEOF_VOID_P EQUAL 8)
- if (${BUILD_AS_64BIT_SUPPORT} STREQUAL "YES")
- # Add -fPIC flag if build as 64-bit
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
- set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
- else ()
- add_definitions (-m32)
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
- endif ()
-endif ()
-
-set(lv_name lvgl)
-set(LVGL_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../build/lvgl)
-set(LVGL_DRIVER_DIR ${CMAKE_CURRENT_LIST_DIR}/lv-drivers)
-
-message(${LVGL_SOURCE_DIR})
-include( ExternalProject )
-
-add_definitions(-DLV_CONF_INCLUDE_SIMPLE)
-
-SET (LVGL_SOURCES
- ${LVGL_SOURCE_DIR}/lv_core/lv_group.c
- ${LVGL_SOURCE_DIR}/lv_core/lv_indev.c
- ${LVGL_SOURCE_DIR}/lv_core/lv_lang.c
- ${LVGL_SOURCE_DIR}/lv_core/lv_obj.c
- ${LVGL_SOURCE_DIR}/lv_core/lv_refr.c
- ${LVGL_SOURCE_DIR}/lv_core/lv_style.c
- ${LVGL_SOURCE_DIR}/lv_core/lv_vdb.c
-
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_arc.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_img.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_label.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_line.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_rbasic.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_rect.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_triangle.c
- ${LVGL_SOURCE_DIR}/lv_draw/lv_draw_vbasic.c
-
- ${LVGL_SOURCE_DIR}/lv_hal/lv_hal_disp.c
- ${LVGL_SOURCE_DIR}/lv_hal/lv_hal_indev.c
- ${LVGL_SOURCE_DIR}/lv_hal/lv_hal_tick.c
-
- ${LVGL_SOURCE_DIR}/lv_misc/lv_anim.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_area.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_circ.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_color.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_font.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_fs.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_gc.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_ll.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_log.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_math.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_mem.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_task.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_templ.c
- ${LVGL_SOURCE_DIR}/lv_misc/lv_txt.c
-
- ${LVGL_SOURCE_DIR}/lv_objx/lv_arc.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_bar.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_btn.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_btnm.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_calendar.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_canvas.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_cb.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_chart.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_cont.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_ddlist.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_gauge.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_img.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_imgbtn.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_kb.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_label.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_led.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_line.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_list.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_lmeter.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_mbox.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_objx_templ.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_page.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_preload.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_roller.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_slider.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_spinbox.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_sw.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_ta.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_table.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_tabview.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_tileview.c
- ${LVGL_SOURCE_DIR}/lv_objx/lv_win.c
-
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_alien.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_default.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_material.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_mono.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_nemo.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_night.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_templ.c
- ${LVGL_SOURCE_DIR}/lv_themes/lv_theme_zen.c
-
- ${LVGL_SOURCE_DIR}/lv_fonts/lv_font_builtin.c
- ${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_20.c
- ${LVGL_DRIVER_DIR}/linux_display_indev.c
- ${LVGL_DRIVER_DIR}/indev/mouse.c
-
-)
-SET(SOURCES
- ${LVGL_SOURCES}
- ${CMAKE_CURRENT_LIST_DIR}/main.c
- )
-include_directories(
- ${LVGL_DRIVER_DIR}
- ${LVGL_DRIVER_DIR}/display
- ${LVGL_DRIVER_DIR}/indev
- ${LVGL_SOURCE_DIR}
- ${LVGL_SOURCE_DIR}/..
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_LIST_DIR}
- ${CMAKE_CURRENT_LIST_DIR}/../lv_config
-)
-add_executable(vgl_native_ui_app ${SOURCES} )
-target_link_libraries( vgl_native_ui_app -lSDL2)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt.in b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt.in
deleted file mode 100644
index 25f4db955..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/CMakeLists.txt.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 2.8.2)
-
-project(lvgl_download NONE)
-
-include(ExternalProject)
-ExternalProject_Add(${lv_name}
- GIT_REPOSITORY https://github.com/lvgl/lvgl.git
- GIT_TAG v5.3
- BINARY_DIR ""
- SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/../build/lvgl"
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- TEST_COMMAND ""
- )
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/.gitignore
deleted file mode 100644
index 2372cca06..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-**/*.o \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/display_indev.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/display_indev.h
deleted file mode 100644
index 95136e285..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/display_indev.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#ifndef DISPLAY_INDEV_H_
-#define DISPLAY_INDEV_H_
-#include <stdio.h>
-#include <inttypes.h>
-#include "mouse.h"
-#include "lvgl/lv_misc/lv_color.h"
-#include "lvgl/lv_hal/lv_hal_indev.h"
-extern void
-display_init(void);
-extern void
-display_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p);
-extern bool
-display_input_read(lv_indev_data_t *data);
-extern void
-display_deinit(void);
-extern void
-display_vdb_write(void *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
- lv_color_t *color, lv_opa_t opa);
-extern int
-time_get_ms();
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.c
deleted file mode 100644
index 848b2eca2..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * @file mouse.c
- *
- */
-
-/*********************
- * INCLUDES
- *********************/
-#include "mouse.h"
-#if USE_MOUSE != 0
-
-/*********************
- * DEFINES
- *********************/
-#ifndef MONITOR_ZOOM
-#define MONITOR_ZOOM 1
-#endif
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-
-/**********************
- * STATIC VARIABLES
- **********************/
-static bool left_button_down = false;
-static int16_t last_x = 0;
-static int16_t last_y = 0;
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-
-/**
- * Initialize the mouse
- */
-void
-mouse_init(void)
-{}
-
-/**
- * Get the current position and state of the mouse
- * @param data store the mouse data here
- * @return false: because the points are not buffered, so no more data to be
- * read
- */
-bool
-mouse_read(lv_indev_data_t *data)
-{
- /*Store the collected data*/
- data->point.x = last_x;
- data->point.y = last_y;
- data->state = left_button_down ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
-
- return false;
-}
-
-/**
- * It will be called from the main SDL thread
- */
-void
-mouse_handler(SDL_Event *event)
-{
- switch (event->type) {
- case SDL_MOUSEBUTTONUP:
- if (event->button.button == SDL_BUTTON_LEFT)
- left_button_down = false;
- break;
- case SDL_MOUSEBUTTONDOWN:
- if (event->button.button == SDL_BUTTON_LEFT) {
- left_button_down = true;
- last_x = event->motion.x / MONITOR_ZOOM;
- last_y = event->motion.y / MONITOR_ZOOM;
- }
- break;
- case SDL_MOUSEMOTION:
- last_x = event->motion.x / MONITOR_ZOOM;
- last_y = event->motion.y / MONITOR_ZOOM;
-
- break;
- }
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.h
deleted file mode 100644
index 07e492f96..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/indev/mouse.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file mouse.h
- *
- */
-
-#ifndef MOUSE_H
-#define MOUSE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*********************
- * INCLUDES
- *********************/
-
-#include "lv_drv_conf.h"
-
-#if USE_MOUSE
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "lvgl/lv_hal/lv_hal_indev.h"
-
-#ifndef MONITOR_SDL_INCLUDE_PATH
-#define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h>
-#endif
-
-#include MONITOR_SDL_INCLUDE_PATH
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * GLOBAL PROTOTYPES
- **********************/
-
-/**
- * Initialize the mouse
- */
-void
-mouse_init(void);
-/**
- * Get the current position and state of the mouse
- * @param data store the mouse data here
- * @return false: because the points are not buffered, so no more data to be
- * read
- */
-bool
-mouse_read(lv_indev_data_t *data);
-
-/**
- * It will be called from the main SDL thread
- */
-void
-mouse_handler(SDL_Event *event);
-
-/**********************
- * MACROS
- **********************/
-
-#endif /* USE_MOUSE */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* MOUSE_H */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/linux_display_indev.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/linux_display_indev.c
deleted file mode 100644
index bd5071067..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/linux_display_indev.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdbool.h>
-#include "display_indev.h"
-#include "sys/time.h"
-#include "SDL2/SDL.h"
-#define MONITOR_HOR_RES 320
-#define MONITOR_VER_RES 240
-#ifndef MONITOR_ZOOM
-#define MONITOR_ZOOM 1
-#endif
-#define SDL_REFR_PERIOD 50
-void
-monitor_sdl_init(void);
-void
-monitor_sdl_refr_core(void);
-void
-monitor_sdl_clean_up(void);
-static uint32_t tft_fb[MONITOR_HOR_RES * MONITOR_VER_RES];
-
-void
-display_vdb_write(void *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
- lv_color_t *color, lv_opa_t opa)
-{
- unsigned char *buf_xy = buf + 4 * x + 4 * y * buf_w;
- lv_color_t *temp = (lv_color_t *)buf_xy;
- *temp = *color;
- /*
- if (opa != LV_OPA_COVER) {
- lv_color_t mix_color;
-
- mix_color.red = *buf_xy;
- mix_color.green = *(buf_xy+1);
- mix_color.blue = *(buf_xy+2);
- color = lv_color_mix(color, mix_color, opa);
- }
- */
-}
-int
-time_get_ms()
-{
- static struct timeval tv;
- gettimeofday(&tv, NULL);
- long long time_in_mill = (tv.tv_sec) * 1000 + (tv.tv_usec) / 1000;
-
- return (int)time_in_mill;
-}
-
-SDL_Window *window;
-SDL_Renderer *renderer;
-SDL_Texture *texture;
-static volatile bool sdl_inited = false;
-static volatile bool sdl_refr_qry = false;
-static volatile bool sdl_quit_qry = false;
-
-void
-monitor_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p)
-{
- /*Return if the area is out the screen*/
- if (x2 < 0 || y2 < 0 || x1 > MONITOR_HOR_RES - 1
- || y1 > MONITOR_VER_RES - 1) {
- return;
- }
-
- int32_t y;
- uint32_t w = x2 - x1 + 1;
- for (y = y1; y <= y2; y++) {
- memcpy(&tft_fb[y * MONITOR_HOR_RES + x1], color_p,
- w * sizeof(lv_color_t));
-
- color_p += w;
- }
- sdl_refr_qry = true;
-
- /*IMPORTANT! It must be called to tell the system the flush is ready*/
-}
-
-/**
- * Fill out the marked area with a color
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- * @param color fill color
- */
-void
-monitor_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color)
-{
- /*Return if the area is out the screen*/
- if (x2 < 0)
- return;
- if (y2 < 0)
- return;
- if (x1 > MONITOR_HOR_RES - 1)
- return;
- if (y1 > MONITOR_VER_RES - 1)
- return;
-
- /*Truncate the area to the screen*/
- int32_t act_x1 = x1 < 0 ? 0 : x1;
- int32_t act_y1 = y1 < 0 ? 0 : y1;
- int32_t act_x2 = x2 > MONITOR_HOR_RES - 1 ? MONITOR_HOR_RES - 1 : x2;
- int32_t act_y2 = y2 > MONITOR_VER_RES - 1 ? MONITOR_VER_RES - 1 : y2;
-
- int32_t x;
- int32_t y;
- uint32_t color32 = color.full; // lv_color_to32(color);
-
- for (x = act_x1; x <= act_x2; x++) {
- for (y = act_y1; y <= act_y2; y++) {
- tft_fb[y * MONITOR_HOR_RES + x] = color32;
- }
- }
-
- sdl_refr_qry = true;
-}
-
-/**
- * Put a color map to the marked area
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- * @param color_p an array of colors
- */
-void
-monitor_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p)
-{
- /*Return if the area is out the screen*/
- if (x2 < 0)
- return;
- if (y2 < 0)
- return;
- if (x1 > MONITOR_HOR_RES - 1)
- return;
- if (y1 > MONITOR_VER_RES - 1)
- return;
-
- /*Truncate the area to the screen*/
- int32_t act_x1 = x1 < 0 ? 0 : x1;
- int32_t act_y1 = y1 < 0 ? 0 : y1;
- int32_t act_x2 = x2 > MONITOR_HOR_RES - 1 ? MONITOR_HOR_RES - 1 : x2;
- int32_t act_y2 = y2 > MONITOR_VER_RES - 1 ? MONITOR_VER_RES - 1 : y2;
-
- int32_t x;
- int32_t y;
-
- for (y = act_y1; y <= act_y2; y++) {
- for (x = act_x1; x <= act_x2; x++) {
- tft_fb[y * MONITOR_HOR_RES + x] =
- color_p->full; // lv_color_to32(*color_p);
- color_p++;
- }
-
- color_p += x2 - act_x2;
- }
-
- sdl_refr_qry = true;
-}
-
-void
-display_init(void)
-{}
-
-void
-display_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p)
-{
- monitor_flush(x1, y1, x2, y2, color_p);
-}
-void
-display_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color_p)
-{
- monitor_fill(x1, y1, x2, y2, color_p);
-}
-void
-display_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p)
-{
- monitor_map(x1, y1, x2, y2, color_p);
-}
-
-bool
-display_input_read(lv_indev_data_t *data)
-{
- return mouse_read(data);
-}
-
-void
-display_deinit(void)
-{}
-
-int
-monitor_sdl_refr_thread(void *param)
-{
- (void)param;
-
- /*If not OSX initialize SDL in the Thread*/
- monitor_sdl_init();
- /*Run until quit event not arrives*/
- while (sdl_quit_qry == false) {
- /*Refresh handling*/
- monitor_sdl_refr_core();
- }
-
- monitor_sdl_clean_up();
- exit(0);
-
- return 0;
-}
-
-void
-monitor_sdl_refr_core(void)
-{
- if (sdl_refr_qry != false) {
- sdl_refr_qry = false;
-
- SDL_UpdateTexture(texture, NULL, tft_fb,
- MONITOR_HOR_RES * sizeof(uint32_t));
- SDL_RenderClear(renderer);
- /*Test: Draw a background to test transparent screens
- * (LV_COLOR_SCREEN_TRANSP)*/
- // SDL_SetRenderDrawColor(renderer, 0xff, 0, 0, 0xff);
- // SDL_Rect r;
- // r.x = 0; r.y = 0; r.w = MONITOR_HOR_RES; r.w =
- // MONITOR_VER_RES; SDL_RenderDrawRect(renderer, &r);
- /*Update the renderer with the texture containing the rendered image*/
- SDL_RenderCopy(renderer, texture, NULL, NULL);
- SDL_RenderPresent(renderer);
- }
-
- SDL_Event event;
- while (SDL_PollEvent(&event)) {
-#if USE_MOUSE != 0
- mouse_handler(&event);
-#endif
- if ((&event)->type == SDL_WINDOWEVENT) {
- switch ((&event)->window.event) {
-#if SDL_VERSION_ATLEAST(2, 0, 5)
- case SDL_WINDOWEVENT_TAKE_FOCUS:
-#endif
- case SDL_WINDOWEVENT_EXPOSED:
-
- SDL_UpdateTexture(texture, NULL, tft_fb,
- MONITOR_HOR_RES * sizeof(uint32_t));
- SDL_RenderClear(renderer);
- SDL_RenderCopy(renderer, texture, NULL, NULL);
- SDL_RenderPresent(renderer);
- break;
- default:
- break;
- }
- }
- }
-
- /*Sleep some time*/
- SDL_Delay(SDL_REFR_PERIOD);
-}
-int
-quit_filter(void *userdata, SDL_Event *event)
-{
- (void)userdata;
-
- if (event->type == SDL_QUIT) {
- sdl_quit_qry = true;
- }
-
- return 1;
-}
-
-void
-monitor_sdl_clean_up(void)
-{
- SDL_DestroyTexture(texture);
- SDL_DestroyRenderer(renderer);
- SDL_DestroyWindow(window);
- SDL_Quit();
-}
-
-void
-monitor_sdl_init(void)
-{
- /*Initialize the SDL*/
- SDL_Init(SDL_INIT_VIDEO);
-
- SDL_SetEventFilter(quit_filter, NULL);
-
- window = SDL_CreateWindow(
- "TFT Simulator", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
- MONITOR_HOR_RES * MONITOR_ZOOM, MONITOR_VER_RES * MONITOR_ZOOM,
- 0); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/
-
- renderer = SDL_CreateRenderer(window, -1, 0);
- texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
- SDL_TEXTUREACCESS_STATIC, MONITOR_HOR_RES,
- MONITOR_VER_RES);
- SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
-
- /*Initialize the frame buffer to gray (77 is an empirical value) */
- memset(tft_fb, 0x44, MONITOR_HOR_RES * MONITOR_VER_RES * sizeof(uint32_t));
- SDL_UpdateTexture(texture, NULL, tft_fb,
- MONITOR_HOR_RES * sizeof(uint32_t));
- sdl_refr_qry = true;
- sdl_inited = true;
-}
-
-void
-display_SDL_init()
-{
- SDL_CreateThread(monitor_sdl_refr_thread, "sdl_refr", NULL);
- while (sdl_inited == false)
- ; /*Wait until 'sdl_refr' initializes the SDL*/
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/system_header.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/system_header.h
deleted file mode 100644
index a0d790c8e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/lv-drivers/system_header.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-
-int
-time_get_ms();
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/main.c
deleted file mode 100644
index e67847c6c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-native-ui-app/main.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-/**
- * @file main
- *
- */
-
-/*********************
- * INCLUDES
- *********************/
-#include <stdlib.h>
-#include <inttypes.h>
-#include "lvgl/lvgl.h"
-#include "display_indev.h"
-#include <unistd.h>
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-static void
-hal_init(void);
-// static int tick_thread(void * data);
-// static void memory_monitor(void * param);
-
-/**********************
- * STATIC VARIABLES
- **********************/
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-uint32_t count = 0;
-char count_str[11] = { 0 };
-lv_obj_t *hello_world_label;
-lv_obj_t *count_label;
-lv_obj_t *btn1;
-
-lv_obj_t *label_count1;
-int label_count1_value = 0;
-char label_count1_str[11] = { 0 };
-static lv_res_t
-btn_rel_action(lv_obj_t *btn)
-{
- label_count1_value++;
- snprintf(label_count1_str, sizeof(label_count1_str), "%d",
- label_count1_value);
- lv_label_set_text(label_count1, label_count1_str);
- return LV_RES_OK;
-}
-
-int
-main()
-{
- void display_SDL_init();
- display_SDL_init();
-
- /*Initialize LittlevGL*/
- lv_init();
-
- /*Initialize the HAL (display, input devices, tick) for LittlevGL*/
- hal_init();
-
- hello_world_label = lv_label_create(lv_scr_act(), NULL);
- lv_label_set_text(hello_world_label, "Hello world!");
- lv_obj_align(hello_world_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
-
- count_label = lv_label_create(lv_scr_act(), NULL);
- lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
-
- btn1 = lv_btn_create(
- lv_scr_act(), NULL); /*Create a button on the currently loaded screen*/
- lv_btn_set_action(btn1, LV_BTN_ACTION_CLICK,
- btn_rel_action); /*Set function to be called when the
- button is released*/
- lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 20); /*Align below the label*/
-
- /*Create a label on the button*/
- lv_obj_t *btn_label = lv_label_create(btn1, NULL);
- lv_label_set_text(btn_label, "Click ++");
-
- label_count1 = lv_label_create(lv_scr_act(), NULL);
- lv_label_set_text(label_count1, "0");
- lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
-
- while (1) {
- /* Periodically call the lv_task handler.
- * It could be done in a timer interrupt or an OS task too.*/
- if ((count % 100) == 0) {
- snprintf(count_str, sizeof(count_str), "%d", count / 100);
- lv_label_set_text(count_label, count_str);
- }
- lv_task_handler();
- ++count;
- usleep(10 * 1000); /*Just to let the system breath*/
- }
-
- return 0;
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-
-/**
- * Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics
- * library
- */
-void
-display_flush_wrapper(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p)
-{
- display_flush(x1, y1, x2, y2, color_p);
- lv_flush_ready();
-}
-void
-display_vdb_write_wrapper(uint8_t *buf, lv_coord_t buf_w, lv_coord_t x,
- lv_coord_t y, lv_color_t color, lv_opa_t opa)
-{
- display_vdb_write(buf, buf_w, x, y, &color, opa);
-}
-extern void
-display_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- lv_color_t color_p);
-extern void
-display_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p);
-static void
-hal_init(void)
-{
- /* Add a display*/
- lv_disp_drv_t disp_drv;
- lv_disp_drv_init(&disp_drv); /*Basic initialization*/
- disp_drv.disp_flush =
- display_flush_wrapper; /*Used when `LV_VDB_SIZE != 0` in lv_conf.h
- (buffered drawing)*/
- disp_drv.disp_fill = display_fill; /*Used when `LV_VDB_SIZE == 0` in
- lv_conf.h (unbuffered drawing)*/
- disp_drv.disp_map = display_map; /*Used when `LV_VDB_SIZE == 0` in lv_conf.h
- (unbuffered drawing)*/
-#if LV_VDB_SIZE != 0
- disp_drv.vdb_wr = display_vdb_write_wrapper;
-#endif
- lv_disp_drv_register(&disp_drv);
-
- /* Add the mouse as input device
- * Use the 'mouse' driver which reads the PC's mouse*/
- // mouse_init();
- lv_indev_drv_t indev_drv;
- lv_indev_drv_init(&indev_drv); /*Basic initialization*/
- indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read =
- display_input_read; /*This function will be called periodically (by the
- library) to get the mouse position and state*/
- lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/CMakeLists.txt
deleted file mode 100644
index a99959ad5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 2.9)
-
-project (vgl_wasm_runtime)
-
-set (WAMR_BUILD_PLATFORM "linux")
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-################ wamr runtime settings ################
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
-
-## use library and headers in the SDK
-link_directories(${WAMR_ROOT_DIR}/wamr-sdk/out/littlevgl/runtime-sdk/lib)
-include_directories(
- ${WAMR_ROOT_DIR}/wamr-sdk/out/littlevgl/runtime-sdk/include
- ${WAMR_ROOT_DIR}/wamr-sdk/out/littlevgl/runtime-sdk/include/bi-inc/deps
- ${WAMR_ROOT_DIR}/core/shared/utils
- ${WAMR_ROOT_DIR}/core/shared/platform/${WAMR_BUILD_PLATFORM}
-)
-
-############### application related ###############
-include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
-
-add_executable (vgl_wasm_runtime src/platform/${WAMR_BUILD_PLATFORM}/main.c
- src/platform/${WAMR_BUILD_PLATFORM}/iwasm_main.c
- src/platform/${WAMR_BUILD_PLATFORM}/display_indev.c
- src/platform/${WAMR_BUILD_PLATFORM}/mouse.c)
-
-target_link_libraries (vgl_wasm_runtime vmlib -lm -ldl -lpthread -lSDL2)
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/display_indev.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/display_indev.h
deleted file mode 100644
index 273d0ad03..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/display_indev.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef DISPLAY_INDEV_H_
-#define DISPLAY_INDEV_H_
-#include <stdio.h>
-#include <stdbool.h>
-#include <inttypes.h>
-#include "bh_platform.h"
-#include "wasm_export.h"
-
-#define USE_MOUSE 1
-typedef union {
- struct {
- uint8_t blue;
- uint8_t green;
- uint8_t red;
- uint8_t alpha;
- };
- uint32_t full;
-} lv_color32_t;
-
-typedef lv_color32_t lv_color_t;
-typedef uint8_t lv_indev_state_t;
-typedef int16_t lv_coord_t;
-typedef uint8_t lv_opa_t;
-typedef struct {
- lv_coord_t x;
- lv_coord_t y;
-} lv_point_t;
-
-typedef struct {
- union {
- lv_point_t
- point; /*For LV_INDEV_TYPE_POINTER the currently pressed point*/
- uint32_t key; /*For LV_INDEV_TYPE_KEYPAD the currently pressed key*/
- uint32_t btn; /*For LV_INDEV_TYPE_BUTTON the currently pressed button*/
- int16_t enc_diff; /*For LV_INDEV_TYPE_ENCODER number of steps since the
- previous read*/
- };
- void *user_data; /*'lv_indev_drv_t.priv' for this driver*/
- lv_indev_state_t state; /*LV_INDEV_STATE_REL or LV_INDEV_STATE_PR*/
-} lv_indev_data_t;
-
-enum { LV_INDEV_STATE_REL = 0, LV_INDEV_STATE_PR };
-enum {
- LV_OPA_TRANSP = 0,
- LV_OPA_0 = 0,
- LV_OPA_10 = 25,
- LV_OPA_20 = 51,
- LV_OPA_30 = 76,
- LV_OPA_40 = 102,
- LV_OPA_50 = 127,
- LV_OPA_60 = 153,
- LV_OPA_70 = 178,
- LV_OPA_80 = 204,
- LV_OPA_90 = 229,
- LV_OPA_100 = 255,
- LV_OPA_COVER = 255,
-};
-
-extern void
-xpt2046_init(void);
-
-extern bool
-touchscreen_read(lv_indev_data_t *data);
-
-extern bool
-mouse_read(lv_indev_data_t *data);
-
-extern void
-display_init(void);
-
-extern void
-display_deinit(wasm_exec_env_t exec_env);
-
-extern int
-time_get_ms(wasm_exec_env_t exec_env);
-
-extern void
-display_flush(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, lv_color_t *color);
-
-extern void
-display_fill(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, lv_color_t *color);
-
-extern void
-display_map(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, const lv_color_t *color);
-
-extern bool
-display_input_read(wasm_exec_env_t exec_env, void *data);
-
-void
-display_vdb_write(wasm_exec_env_t exec_env, void *buf, lv_coord_t buf_w,
- lv_coord_t x, lv_coord_t y, lv_color_t *color, lv_opa_t opa);
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/display_indev.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/display_indev.c
deleted file mode 100644
index 2b3b00067..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/display_indev.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdbool.h>
-#include "display_indev.h"
-#include "SDL2/SDL.h"
-#include "sys/time.h"
-#include "wasm_export.h"
-#include "app_manager_export.h"
-
-#define MONITOR_HOR_RES 320
-#define MONITOR_VER_RES 240
-#ifndef MONITOR_ZOOM
-#define MONITOR_ZOOM 1
-#endif
-#define SDL_REFR_PERIOD 50
-void
-monitor_sdl_init(void);
-void
-monitor_sdl_refr_core(void);
-void
-monitor_sdl_clean_up(void);
-
-static uint32_t tft_fb[MONITOR_HOR_RES * MONITOR_VER_RES];
-
-int
-time_get_ms(wasm_exec_env_t exec_env)
-{
- static struct timeval tv;
- gettimeofday(&tv, NULL);
- long long time_in_mill = (tv.tv_sec) * 1000 + (tv.tv_usec) / 1000;
-
- return (int)time_in_mill;
-}
-
-SDL_Window *window;
-SDL_Renderer *renderer;
-SDL_Texture *texture;
-static volatile bool sdl_inited = false;
-static volatile bool sdl_refr_qry = false;
-static volatile bool sdl_quit_qry = false;
-
-void
-monitor_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color)
-{
- /*Return if the area is out the screen*/
- if (x2 < 0 || y2 < 0 || x1 > MONITOR_HOR_RES - 1
- || y1 > MONITOR_VER_RES - 1) {
- return;
- }
-
- int32_t y;
- uint32_t w = x2 - x1 + 1;
-
- for (y = y1; y <= y2; y++) {
- memcpy(&tft_fb[y * MONITOR_HOR_RES + x1], color,
- w * sizeof(lv_color_t));
-
- color += w;
- }
- sdl_refr_qry = true;
-
- /*IMPORTANT! It must be called to tell the system the flush is ready*/
-}
-
-/**
- * Fill out the marked area with a color
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- * @param color fill color
- */
-void
-monitor_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *color)
-{
- /*Return if the area is out the screen*/
- if (x2 < 0)
- return;
- if (y2 < 0)
- return;
- if (x1 > MONITOR_HOR_RES - 1)
- return;
- if (y1 > MONITOR_VER_RES - 1)
- return;
-
- /*Truncate the area to the screen*/
- int32_t act_x1 = x1 < 0 ? 0 : x1;
- int32_t act_y1 = y1 < 0 ? 0 : y1;
- int32_t act_x2 = x2 > MONITOR_HOR_RES - 1 ? MONITOR_HOR_RES - 1 : x2;
- int32_t act_y2 = y2 > MONITOR_VER_RES - 1 ? MONITOR_VER_RES - 1 : y2;
-
- int32_t x;
- int32_t y;
- uint32_t color32 = color->full; // lv_color_to32(color);
-
- for (x = act_x1; x <= act_x2; x++) {
- for (y = act_y1; y <= act_y2; y++) {
- tft_fb[y * MONITOR_HOR_RES + x] = color32;
- }
- }
-
- sdl_refr_qry = true;
-}
-
-/**
- * Put a color map to the marked area
- * @param x1 left coordinate
- * @param y1 top coordinate
- * @param x2 right coordinate
- * @param y2 bottom coordinate
- * @param color an array of colors
- */
-void
-monitor_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color)
-{
- /*Return if the area is out the screen*/
- if (x2 < 0)
- return;
- if (y2 < 0)
- return;
- if (x1 > MONITOR_HOR_RES - 1)
- return;
- if (y1 > MONITOR_VER_RES - 1)
- return;
-
- /*Truncate the area to the screen*/
- int32_t act_x1 = x1 < 0 ? 0 : x1;
- int32_t act_y1 = y1 < 0 ? 0 : y1;
- int32_t act_x2 = x2 > MONITOR_HOR_RES - 1 ? MONITOR_HOR_RES - 1 : x2;
- int32_t act_y2 = y2 > MONITOR_VER_RES - 1 ? MONITOR_VER_RES - 1 : y2;
-
- int32_t x;
- int32_t y;
-
- for (y = act_y1; y <= act_y2; y++) {
- for (x = act_x1; x <= act_x2; x++) {
- tft_fb[y * MONITOR_HOR_RES + x] =
- color->full; // lv_color_to32(*color);
- color++;
- }
-
- color += x2 - act_x2;
- }
-
- sdl_refr_qry = true;
-}
-
-void
-display_init(void)
-{}
-
-void
-display_flush(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, lv_color_t *color)
-{
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
-
- if (!wasm_runtime_validate_native_addr(module_inst, color,
- sizeof(lv_color_t)))
- return;
-
- monitor_flush(x1, y1, x2, y2, color);
-}
-
-void
-display_fill(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, lv_color_t *color)
-{
- monitor_fill(x1, y1, x2, y2, color);
-}
-
-void
-display_map(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, const lv_color_t *color)
-{
- monitor_map(x1, y1, x2, y2, color);
-}
-
-typedef struct display_input_data {
- lv_point_t point;
- uint32 user_data_offset;
- uint8 state;
-} display_input_data;
-
-bool
-display_input_read(wasm_exec_env_t exec_env, void *input_data_app)
-{
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- display_input_data *data_app = (display_input_data *)input_data_app;
- bool ret;
-
- if (!wasm_runtime_validate_native_addr(module_inst, data_app,
- sizeof(display_input_data)))
- return false;
-
- lv_indev_data_t data = { 0 };
-
- ret = mouse_read(&data);
-
- data_app->point = data.point;
- data_app->user_data_offset =
- wasm_runtime_addr_native_to_app(module_inst, data.user_data);
- data_app->state = data.state;
-
- return ret;
-}
-
-void
-display_deinit(wasm_exec_env_t exec_env)
-{}
-
-void
-display_vdb_write(wasm_exec_env_t exec_env, void *buf, lv_coord_t buf_w,
- lv_coord_t x, lv_coord_t y, lv_color_t *color, lv_opa_t opa)
-{
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- unsigned char *buf_xy = (unsigned char *)buf + 4 * x + 4 * y * buf_w;
-
- if (!wasm_runtime_validate_native_addr(module_inst, color,
- sizeof(lv_color_t)))
- return;
-
- *(lv_color_t *)buf_xy = *color;
-}
-
-int
-monitor_sdl_refr_thread(void *param)
-{
- (void)param;
-
- /*If not OSX initialize SDL in the Thread*/
- monitor_sdl_init();
- /*Run until quit event not arrives*/
- while (sdl_quit_qry == false) {
- /*Refresh handling*/
- monitor_sdl_refr_core();
- }
-
- monitor_sdl_clean_up();
- exit(0);
-
- return 0;
-}
-extern void
-mouse_handler(SDL_Event *event);
-void
-monitor_sdl_refr_core(void)
-{
- if (sdl_refr_qry != false) {
- sdl_refr_qry = false;
-
- SDL_UpdateTexture(texture, NULL, tft_fb,
- MONITOR_HOR_RES * sizeof(uint32_t));
- SDL_RenderClear(renderer);
- /*Update the renderer with the texture containing the rendered image*/
- SDL_RenderCopy(renderer, texture, NULL, NULL);
- SDL_RenderPresent(renderer);
- }
-
- SDL_Event event;
- while (SDL_PollEvent(&event)) {
-
- mouse_handler(&event);
-
- if ((&event)->type == SDL_WINDOWEVENT) {
- switch ((&event)->window.event) {
-#if SDL_VERSION_ATLEAST(2, 0, 5)
- case SDL_WINDOWEVENT_TAKE_FOCUS:
-#endif
- case SDL_WINDOWEVENT_EXPOSED:
-
- SDL_UpdateTexture(texture, NULL, tft_fb,
- MONITOR_HOR_RES * sizeof(uint32_t));
- SDL_RenderClear(renderer);
- SDL_RenderCopy(renderer, texture, NULL, NULL);
- SDL_RenderPresent(renderer);
- break;
- default:
- break;
- }
- }
- }
-
- /*Sleep some time*/
- SDL_Delay(SDL_REFR_PERIOD);
-}
-int
-quit_filter(void *userdata, SDL_Event *event)
-{
- (void)userdata;
-
- if (event->type == SDL_QUIT) {
- sdl_quit_qry = true;
- }
-
- return 1;
-}
-
-void
-monitor_sdl_clean_up(void)
-{
- SDL_DestroyTexture(texture);
- SDL_DestroyRenderer(renderer);
- SDL_DestroyWindow(window);
- SDL_Quit();
-}
-
-void
-monitor_sdl_init(void)
-{
- /*Initialize the SDL*/
- SDL_Init(SDL_INIT_VIDEO);
-
- SDL_SetEventFilter(quit_filter, NULL);
-
- window = SDL_CreateWindow(
- "TFT Simulator", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
- MONITOR_HOR_RES * MONITOR_ZOOM, MONITOR_VER_RES * MONITOR_ZOOM,
- 0); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/
-
- renderer = SDL_CreateRenderer(window, -1, 0);
- texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
- SDL_TEXTUREACCESS_STATIC, MONITOR_HOR_RES,
- MONITOR_VER_RES);
- SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
-
- /*Initialize the frame buffer to gray (77 is an empirical value) */
- memset(tft_fb, 0x44, MONITOR_HOR_RES * MONITOR_VER_RES * sizeof(uint32_t));
- SDL_UpdateTexture(texture, NULL, tft_fb,
- MONITOR_HOR_RES * sizeof(uint32_t));
- sdl_refr_qry = true;
- sdl_inited = true;
-}
-
-void
-display_SDL_init()
-{
- SDL_CreateThread(monitor_sdl_refr_thread, "sdl_refr", NULL);
- while (sdl_inited == false)
- ; /*Wait until 'sdl_refr' initializes the SDL*/
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/iwasm_main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/iwasm_main.c
deleted file mode 100644
index e2253bb5e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/iwasm_main.c
+++ /dev/null
@@ -1,544 +0,0 @@
-
-#ifndef CONNECTION_UART
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#else
-#include <termios.h>
-#endif
-
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <unistd.h>
-#include <strings.h>
-
-#include "runtime_lib.h"
-#include "runtime_timer.h"
-#include "native_interface.h"
-#include "app_manager_export.h"
-#include "bh_platform.h"
-#include "bi-inc/attr_container.h"
-#include "module_wasm_app.h"
-#include "wasm_export.h"
-#include "sensor_native_api.h"
-#include "connection_native_api.h"
-#include "display_indev.h"
-
-#define MAX 2048
-
-#ifndef CONNECTION_UART
-#define SA struct sockaddr
-static char *host_address = "127.0.0.1";
-static int port = 8888;
-#else
-static char *uart_device = "/dev/ttyS2";
-static int baudrate = B115200;
-#endif
-
-extern bool
-init_sensor_framework();
-extern void
-exit_sensor_framework();
-extern void
-exit_connection_framework();
-extern int
-aee_host_msg_callback(void *msg, uint32_t msg_len);
-extern bool
-init_connection_framework();
-
-#ifndef CONNECTION_UART
-int listenfd = -1;
-int sockfd = -1;
-static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
-#else
-int uartfd = -1;
-#endif
-
-#ifndef CONNECTION_UART
-static bool server_mode = false;
-
-// Function designed for chat between client and server.
-void *
-func(void *arg)
-{
- char buff[MAX];
- int n;
- struct sockaddr_in servaddr;
-
- while (1) {
- if (sockfd != -1)
- close(sockfd);
- // socket create and verification
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd == -1) {
- printf("socket creation failed...\n");
- return NULL;
- }
- else
- printf("Socket successfully created..\n");
- bzero(&servaddr, sizeof(servaddr));
- // assign IP, PORT
- servaddr.sin_family = AF_INET;
- servaddr.sin_addr.s_addr = inet_addr(host_address);
- servaddr.sin_port = htons(port);
-
- // connect the client socket to server socket
- if (connect(sockfd, (SA *)&servaddr, sizeof(servaddr)) != 0) {
- printf("connection with the server failed...\n");
- sleep(10);
- continue;
- }
- else {
- printf("connected to the server..\n");
- }
-
- // infinite loop for chat
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
- // print buffer which contains the client contents
- // fprintf(stderr, "recieved %d bytes from host: %s", n, buff);
-
- // socket disconnected
- if (n <= 0)
- break;
-
- aee_host_msg_callback(buff, n);
- }
- }
-
- // After chatting close the socket
- close(sockfd);
-}
-
-static bool
-host_init()
-{
- return true;
-}
-
-int
-host_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- if (pthread_mutex_trylock(&sock_lock) == 0) {
- if (sockfd == -1) {
- pthread_mutex_unlock(&sock_lock);
- return 0;
- }
-
- ret = write(sockfd, buf, size);
-
- pthread_mutex_unlock(&sock_lock);
- return ret;
- }
-
- return -1;
-}
-
-void
-host_destroy()
-{
- if (server_mode)
- close(listenfd);
-
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- pthread_mutex_unlock(&sock_lock);
-}
-
-host_interface interface = { .init = host_init,
- .send = host_send,
- .destroy = host_destroy };
-
-void *
-func_server_mode(void *arg)
-{
- int clilent;
- struct sockaddr_in serv_addr, cli_addr;
- int n;
- char buff[MAX];
- struct sigaction sa;
-
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGPIPE, &sa, 0);
-
- /* First call to socket() function */
- listenfd = socket(AF_INET, SOCK_STREAM, 0);
-
- if (listenfd < 0) {
- perror("ERROR opening socket");
- exit(1);
- }
-
- /* Initialize socket structure */
- bzero((char *)&serv_addr, sizeof(serv_addr));
-
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = INADDR_ANY;
- serv_addr.sin_port = htons(port);
-
- /* Now bind the host address using bind() call.*/
- if (bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
- perror("ERROR on binding");
- exit(1);
- }
-
- listen(listenfd, 5);
- clilent = sizeof(cli_addr);
-
- while (1) {
- pthread_mutex_lock(&sock_lock);
-
- sockfd = accept(listenfd, (struct sockaddr *)&cli_addr, &clilent);
-
- pthread_mutex_unlock(&sock_lock);
-
- if (sockfd < 0) {
- perror("ERROR on accept");
- exit(1);
- }
-
- printf("connection established!\n");
-
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
-
- // socket disconnected
- if (n <= 0) {
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- sockfd = -1;
- pthread_mutex_unlock(&sock_lock);
-
- sleep(2);
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
- }
-}
-
-#else
-static int
-parse_baudrate(int baud)
-{
- switch (baud) {
- case 9600:
- return B9600;
- case 19200:
- return B19200;
- case 38400:
- return B38400;
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
- case 2500000:
- return B2500000;
- case 3000000:
- return B3000000;
- case 3500000:
- return B3500000;
- case 4000000:
- return B4000000;
- default:
- return -1;
- }
-}
-static bool
-uart_init(const char *device, int baudrate, int *fd)
-{
- int uart_fd;
- struct termios uart_term;
-
- uart_fd = open(device, O_RDWR | O_NOCTTY);
-
- if (uart_fd <= 0)
- return false;
-
- memset(&uart_term, 0, sizeof(uart_term));
- uart_term.c_cflag = baudrate | CS8 | CLOCAL | CREAD;
- uart_term.c_iflag = IGNPAR;
- uart_term.c_oflag = 0;
-
- /* set noncanonical mode */
- uart_term.c_lflag = 0;
- uart_term.c_cc[VTIME] = 30;
- uart_term.c_cc[VMIN] = 1;
- tcflush(uart_fd, TCIFLUSH);
-
- if (tcsetattr(uart_fd, TCSANOW, &uart_term) != 0) {
- close(uart_fd);
- return false;
- }
-
- *fd = uart_fd;
-
- return true;
-}
-
-static void *
-func_uart_mode(void *arg)
-{
- int n;
- char buff[MAX];
-
- if (!uart_init(uart_device, baudrate, &uartfd)) {
- printf("open uart fail! %s\n", uart_device);
- return NULL;
- }
-
- for (;;) {
- bzero(buff, MAX);
-
- n = read(uartfd, buff, sizeof(buff));
-
- if (n <= 0) {
- close(uartfd);
- uartfd = -1;
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
-
- return NULL;
-}
-
-static int
-uart_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- ret = write(uartfd, buf, size);
-
- return ret;
-}
-
-static void
-uart_destroy()
-{
- close(uartfd);
-}
-
-static host_interface interface = { .send = uart_send,
- .destroy = uart_destroy };
-
-#endif
-
-#ifdef __x86_64__
-static char global_heap_buf[400 * 1024] = { 0 };
-#else
-static char global_heap_buf[270 * 1024] = { 0 };
-#endif
-
-/* clang-format off */
-static void showUsage()
-{
-#ifndef CONNECTION_UART
- printf("Usage:\n");
- printf("\nWork as TCP server mode:\n");
- printf("\tvgl_wasm_runtime -s|--server_mode -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Port> represents the port that would be listened on and the default is 8888\n");
- printf("\nWork as TCP client mode:\n");
- printf("\tvgl_wasm_runtime -a|--host_address <Host Address> -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Host Address> represents the network address of host and the default is 127.0.0.1\n");
- printf("\t<Port> represents the listen port of host and the default is 8888\n");
-#else
- printf("Usage:\n");
- printf("\tvgl_wasm_runtime -u <Uart Device> -b <Baudrate>\n\n");
- printf("where\n");
- printf("\t<Uart Device> represents the UART device name and the default is /dev/ttyS2\n");
- printf("\t<Baudrate> represents the UART device baudrate and the default is 115200\n");
-#endif
- printf("\nNote:\n");
- printf("\tUse -w|--wasi_root to specify the root dir (default to '.') of WASI wasm modules. \n");
-}
-/* clang-format on */
-
-static bool
-parse_args(int argc, char *argv[])
-{
- int c;
-
- while (1) {
- int optIndex = 0;
- static struct option longOpts[] = {
-#ifndef CONNECTION_UART
- { "server_mode", no_argument, NULL, 's' },
- { "host_address", required_argument, NULL, 'a' },
- { "port", required_argument, NULL, 'p' },
-#else
- { "uart", required_argument, NULL, 'u' },
- { "baudrate", required_argument, NULL, 'b' },
-#endif
-#if WASM_ENABLE_LIBC_WASI != 0
- { "wasi_root", required_argument, NULL, 'w' },
-#endif
- { "help", required_argument, NULL, 'h' },
- { 0, 0, 0, 0 }
- };
-
- c = getopt_long(argc, argv, "sa:p:u:b:w:h", longOpts, &optIndex);
- if (c == -1)
- break;
-
- switch (c) {
-#ifndef CONNECTION_UART
- case 's':
- server_mode = true;
- break;
- case 'a':
- host_address = optarg;
- printf("host address: %s\n", host_address);
- break;
- case 'p':
- port = atoi(optarg);
- printf("port: %d\n", port);
- break;
-#else
- case 'u':
- uart_device = optarg;
- printf("uart device: %s\n", uart_device);
- break;
- case 'b':
- baudrate = parse_baudrate(atoi(optarg));
- printf("uart baudrate: %s\n", optarg);
- break;
-#endif
-#if WASM_ENABLE_LIBC_WASI != 0
- case 'w':
- if (!wasm_set_wasi_root_dir(optarg)) {
- printf("Fail to set wasi root dir: %s\n", optarg);
- return false;
- }
- break;
-#endif
- case 'h':
- showUsage();
- return false;
- default:
- showUsage();
- return false;
- }
- }
-
- return true;
-}
-
-static NativeSymbol native_symbols[] = {
- EXPORT_WASM_API_WITH_SIG(display_input_read, "(*)i"),
- EXPORT_WASM_API_WITH_SIG(display_flush, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(display_fill, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(display_vdb_write, "(*iii*i)"),
- EXPORT_WASM_API_WITH_SIG(display_map, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(time_get_ms, "()i")
-};
-
-// Driver function
-int
-iwasm_main(int argc, char *argv[])
-{
- RuntimeInitArgs init_args;
- korp_tid tid;
- uint32 n_native_symbols;
-
- if (!parse_args(argc, argv))
- return -1;
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- init_args.native_module_name = "env";
- init_args.n_native_symbols = sizeof(native_symbols) / sizeof(NativeSymbol);
- init_args.native_symbols = native_symbols;
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- if (!init_connection_framework()) {
- goto fail1;
- }
-
- extern void display_SDL_init();
- display_SDL_init();
-
- if (!init_sensor_framework()) {
- goto fail2;
- }
-
- /* timer manager */
- if (!init_wasm_timer()) {
- goto fail3;
- }
-
-#ifndef CONNECTION_UART
- if (server_mode)
- os_thread_create(&tid, func_server_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
- else
- os_thread_create(&tid, func, NULL, BH_APPLET_PRESERVED_STACK_SIZE);
-#else
- os_thread_create(&tid, func_uart_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
-#endif
-
- app_manager_startup(&interface);
-
- exit_wasm_timer();
-
-fail3:
- exit_sensor_framework();
-
-fail2:
- exit_connection_framework();
-
-fail1:
- wasm_runtime_destroy();
-
- return -1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/main.c
deleted file mode 100644
index 63e24f11d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/main.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-extern int
-iwasm_main(int argc, char *argv[]);
-int
-main(int argc, char *argv[])
-{
- return iwasm_main(argc, argv);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/mouse.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/mouse.c
deleted file mode 100644
index 45eb8cfe5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/linux/mouse.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file mouse.c
- *
- */
-
-/*********************
- * INCLUDES
- *********************/
-#include "display_indev.h"
-#include "SDL2/SDL.h"
-#if USE_MOUSE != 0
-
-/*********************
- * DEFINES
- *********************/
-#ifndef MONITOR_ZOOM
-#define MONITOR_ZOOM 1
-#endif
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-
-/**********************
- * STATIC VARIABLES
- **********************/
-static bool left_button_down = false;
-static int16_t last_x = 0;
-static int16_t last_y = 0;
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-
-/**
- * Initialize the mouse
- */
-void
-mouse_init(void)
-{}
-
-/**
- * Get the current position and state of the mouse
- * @param data store the mouse data here
- * @return false: because the points are not buffered, so no more data to be
- * read
- */
-bool
-mouse_read(lv_indev_data_t *data)
-{
- /*Store the collected data*/
- data->point.x = last_x;
- data->point.y = last_y;
- data->state = left_button_down ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
-
- return false;
-}
-
-/**
- * It will be called from the main SDL thread
- */
-void
-mouse_handler(SDL_Event *event)
-{
- switch (event->type) {
- case SDL_MOUSEBUTTONUP:
- if (event->button.button == SDL_BUTTON_LEFT)
- left_button_down = false;
- break;
- case SDL_MOUSEBUTTONDOWN:
- if (event->button.button == SDL_BUTTON_LEFT) {
- left_button_down = true;
- last_x = event->motion.x / MONITOR_ZOOM;
- last_y = event->motion.y / MONITOR_ZOOM;
- }
- break;
- case SDL_MOUSEMOTION:
- last_x = event->motion.x / MONITOR_ZOOM;
- last_y = event->motion.y / MONITOR_ZOOM;
-
- break;
- }
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/LICENSE b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/LICENSE
deleted file mode 100644
index 8f71f43fe..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c
deleted file mode 100644
index d59b6c9b7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/**
- * @file XPT2046.c
- */
-/*********************
- * INCLUDES
- *********************/
-#include "XPT2046.h"
-#include "board_config.h"
-#include "stdio.h"
-#include <string.h>
-#include "drivers/spi.h"
-
-#include "zephyr.h"
-#include "kernel.h"
-
-#if USE_XPT2046
-
-#include <stddef.h>
-
-#define abs(x) ((x) < 0 ? -(x) : (x))
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-static void
-xpt2046_corr(int16_t *x, int16_t *y);
-#if 0
-static void xpt2046_avg(int16_t * x, int16_t * y);
-#endif
-
-/**********************
- * STATIC VARIABLES
- **********************/
-int16_t avg_buf_x[XPT2046_AVG];
-int16_t avg_buf_y[XPT2046_AVG];
-uint8_t avg_last;
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-
-/**
- * Initialize the XPT2046
- */
-struct device *input_dev;
-
-struct spi_config spi_conf_xpt2046;
-struct spi_cs_control xpt2046_cs_ctrl;
-struct device *xpt2046_pen_gpio_dev;
-static struct gpio_callback gpio_cb;
-lv_indev_data_t touch_point;
-lv_indev_data_t last_touch_point;
-
-#define TOUCH_READ_THREAD_STACK_SIZE 4096
-static K_THREAD_STACK_DEFINE(touch_read_thread_stack,
- TOUCH_READ_THREAD_STACK_SIZE);
-static struct k_thread touch_thread_data;
-static struct k_sem sem_touch_read;
-
-K_MUTEX_DEFINE(spi_display_touch_mutex);
-
-int cnt = 0;
-int touch_read_times = 0;
-int last_pen_interrupt_time = 0;
-
-void
-xpt2046_pen_gpio_callback(struct device *port, struct gpio_callback *cb,
- uint32_t pins)
-{
- cnt++;
- if ((k_uptime_get_32() - last_pen_interrupt_time) > 500) {
- k_sem_give(&sem_touch_read);
- touch_read_times++;
- last_pen_interrupt_time = k_uptime_get_32();
- }
-}
-
-void
-disable_pen_interrupt()
-{
- int ret = 0;
- ret = gpio_disable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
- if (ret != 0) {
- printf("gpio_pin_configure GPIO_INPUT failed\n");
- }
-}
-void
-enable_pen_interrupt()
-{
- int ret = 0;
- ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
- if (ret != 0) {
- printf("gpio_pin_configure failed\n");
- }
-}
-
-void
-touch_screen_read_thread()
-{
- int i;
- bool ret = false;
-
- for (;;) {
- k_sem_take(&sem_touch_read, K_FOREVER);
- memset(&last_touch_point, 0, sizeof(lv_indev_data_t));
- memset(&touch_point, 0, sizeof(lv_indev_data_t));
- memset(avg_buf_x, 0, sizeof(avg_buf_x));
- memset(avg_buf_y, 0, sizeof(avg_buf_y));
- k_mutex_lock(&spi_display_touch_mutex, K_FOREVER);
- disable_pen_interrupt();
- for (i = 0; i < 100; i++) {
- ret = xpt2046_read(&touch_point);
- if (ret) {
- if ((abs(last_touch_point.point.x - touch_point.point.x) < 4)
- && (abs(last_touch_point.point.y - touch_point.point.y)
- < 4)) {
- break;
- }
- last_touch_point = touch_point;
- }
- }
- enable_pen_interrupt();
- k_mutex_unlock(&spi_display_touch_mutex);
- }
-}
-
-void
-xpt2046_init(void)
-{
- int ret;
- input_dev = device_get_binding(XPT2046_SPI_DEVICE_NAME);
-
- if (input_dev == NULL) {
- printf("device not found. Aborting test.");
- return;
- }
- memset((void *)&touch_point, 0, sizeof(lv_indev_data_t));
-
- spi_conf_xpt2046.frequency = XPT2046_SPI_MAX_FREQUENCY;
- spi_conf_xpt2046.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
- spi_conf_xpt2046.slave = 0;
- spi_conf_xpt2046.cs = NULL;
-#ifdef XPT2046_CS_GPIO_CONTROLLER
- xpt2046_cs_ctrl.gpio_dev = device_get_binding(XPT2046_CS_GPIO_CONTROLLER);
- if (xpt2046_cs_ctrl.gpio_dev == NULL) {
- printk("Cannot find %s!\n", XPT2046_CS_GPIO_CONTROLLER);
- return;
- }
- gpio_pin_configure(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN,
- GPIO_OUTPUT);
- gpio_pin_set(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
- xpt2046_cs_ctrl.gpio_pin = XPT2046_CS_GPIO_PIN;
- xpt2046_cs_ctrl.delay = 0;
- spi_conf_xpt2046.cs = &xpt2046_cs_ctrl;
-
-#endif
-
-#ifdef XPT2046_PEN_GPIO_CONTROLLER
-
- xpt2046_pen_gpio_dev = device_get_binding(XPT2046_PEN_GPIO_CONTROLLER);
- if (!xpt2046_pen_gpio_dev) {
- printk("Cannot find %s!\n", XPT2046_PEN_GPIO_CONTROLLER);
- return;
- }
- /* Setup GPIO input */
- ret = gpio_pin_configure(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN,
- (GPIO_INPUT | GPIO_INT_ENABLE | GPIO_INT_EDGE
- | GPIO_INT_LOW_0 | GPIO_INT_DEBOUNCE));
- if (ret) {
- printk("Error configuring pin %d!\n", XPT2046_PEN_GPIO_PIN);
- }
-
- gpio_init_callback(&gpio_cb, xpt2046_pen_gpio_callback,
- BIT(XPT2046_PEN_GPIO_PIN));
-
- ret = gpio_add_callback(xpt2046_pen_gpio_dev, &gpio_cb);
- if (ret) {
- printk("gpio_add_callback error\n");
- }
- ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
- if (ret) {
- printk("gpio_enable_callback error\n");
- }
-#endif
-
- k_sem_init(&sem_touch_read, 0, 1);
-
- k_thread_create(&touch_thread_data, touch_read_thread_stack,
- TOUCH_READ_THREAD_STACK_SIZE, touch_screen_read_thread,
- NULL, NULL, NULL, 5, 0, K_NO_WAIT);
- printf("xpt2046_init ok \n");
-}
-
-/**
- * Get the current position and state of the touchpad
- * @param data store the read data here
- * @return false: because no ore data to be read
- */
-bool
-xpt2046_read(lv_indev_data_t *data)
-{
- static int16_t last_x = 0;
- static int16_t last_y = 0;
- bool valid = true;
- int s32_ret = 0;
-
- int16_t x = 0;
- int16_t y = 0;
-
- char tx1[16] = { 0 };
- char rx1[16] = { 0 };
-
- struct spi_buf tx_buf = { .buf = &tx1, .len = 3 };
- struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
- struct spi_buf rx_buf = { .buf = &rx1, .len = 3 };
- struct spi_buf_set rx_bufs = { .buffers = &rx_buf, .count = 1 };
-
- tx1[0] = CMD_X_READ;
- s32_ret = spi_transceive(input_dev, &spi_conf_xpt2046, &tx_bufs, &rx_bufs);
- if (s32_ret != 0) {
- printf("spi_transceive return failed:%d\n", s32_ret);
- }
- x = rx1[1] << 8;
- x += rx1[2];
-
- tx1[0] = CMD_Y_READ;
- s32_ret = spi_transceive(input_dev, &spi_conf_xpt2046, &tx_bufs, &rx_bufs);
- if (s32_ret != 0) {
- printf("spi_transceive return failed:%d\n", s32_ret);
- }
- y = rx1[1] << 8;
- y += rx1[2];
- x = x >> 3;
- y = y >> 3;
-
- xpt2046_corr(&x, &y);
- if (y <= 0 || (x > 320)) {
- valid = false;
- }
-
- last_x = x;
- last_y = y;
-
- data->point.x = x;
- data->point.y = y;
- data->state = valid == false ? LV_INDEV_STATE_REL : LV_INDEV_STATE_PR;
-
- return valid;
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-static void
-xpt2046_corr(int16_t *x, int16_t *y)
-{
-#if XPT2046_XY_SWAP != 0
- int16_t swap_tmp;
- swap_tmp = *x;
- *x = *y;
- *y = swap_tmp;
-#endif
-
- if ((*x) > XPT2046_X_MIN)
- (*x) -= XPT2046_X_MIN;
- else
- (*x) = 0;
-
- if ((*y) > XPT2046_Y_MIN)
- (*y) -= XPT2046_Y_MIN;
- else
- (*y) = 0;
-
- (*x) = (uint32_t)((uint32_t)(*x) * XPT2046_HOR_RES)
- / (XPT2046_X_MAX - XPT2046_X_MIN);
-
- (*y) = (uint32_t)((uint32_t)(*y) * XPT2046_VER_RES)
- / (XPT2046_Y_MAX - XPT2046_Y_MIN);
-
-#if XPT2046_X_INV != 0
- (*x) = XPT2046_HOR_RES - (*x);
-#endif
-
-#if XPT2046_Y_INV != 0
- (*y) = XPT2046_VER_RES - (*y);
-#endif
-}
-
-#if 0
-static void xpt2046_avg(int16_t * x, int16_t * y)
-{
- /*Shift out the oldest data*/
- uint8_t i;
- for (i = XPT2046_AVG - 1; i > 0; i--) {
- avg_buf_x[i] = avg_buf_x[i - 1];
- avg_buf_y[i] = avg_buf_y[i - 1];
- }
-
- /*Insert the new point*/
- avg_buf_x[0] = *x;
- avg_buf_y[0] = *y;
- if (avg_last < XPT2046_AVG)
- avg_last++;
-
- /*Sum the x and y coordinates*/
- int32_t x_sum = 0;
- int32_t y_sum = 0;
- for (i = 0; i < avg_last; i++) {
- x_sum += avg_buf_x[i];
- y_sum += avg_buf_y[i];
- }
-
- /*Normalize the sums*/
- (*x) = (int32_t) x_sum / avg_last;
- (*y) = (int32_t) y_sum / avg_last;
-}
-#endif
-
-bool
-touchscreen_read(lv_indev_data_t *data)
-{
- /*Store the collected data*/
- data->point.x = last_touch_point.point.x;
- data->point.y = last_touch_point.point.y;
- data->state = last_touch_point.state;
-
- if (last_touch_point.state == LV_INDEV_STATE_PR) {
- last_touch_point.state = LV_INDEV_STATE_REL;
- }
- return false;
-}
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.h
deleted file mode 100644
index 3cd3a571d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * @file XPT2046.h
- *
- */
-
-#ifndef XPT2046_H
-#define XPT2046_H
-
-#define USE_XPT2046 1
-
-#define XPT2046_HOR_RES 320
-#define XPT2046_VER_RES 240
-#define XPT2046_X_MIN 200
-#define XPT2046_Y_MIN 200
-#define XPT2046_X_MAX 3800
-#define XPT2046_Y_MAX 3800
-#define XPT2046_AVG 4
-#define XPT2046_INV 0
-
-#define CMD_X_READ 0b10010000
-#define CMD_Y_READ 0b11010000
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*********************
- * INCLUDES
- *********************/
-
-#if USE_XPT2046
-#include <autoconf.h>
-#include <stdint.h>
-#include <stdbool.h>
-//#include "lvgl/lv_hal/lv_hal_indev.h"
-#include "device.h"
-#include "drivers/gpio.h"
-#if 1
-enum { LV_INDEV_STATE_REL = 0, LV_INDEV_STATE_PR };
-typedef uint8_t lv_indev_state_t;
-typedef int16_t lv_coord_t;
-typedef struct {
- lv_coord_t x;
- lv_coord_t y;
-} lv_point_t;
-
-typedef struct {
- union {
- lv_point_t
- point; /*For LV_INDEV_TYPE_POINTER the currently pressed point*/
- uint32_t key; /*For LV_INDEV_TYPE_KEYPAD the currently pressed key*/
- uint32_t btn; /*For LV_INDEV_TYPE_BUTTON the currently pressed button*/
- int16_t enc_diff; /*For LV_INDEV_TYPE_ENCODER number of steps since the
- previous read*/
- };
- void *user_data; /*'lv_indev_drv_t.priv' for this driver*/
- lv_indev_state_t state; /*LV_INDEV_STATE_REL or LV_INDEV_STATE_PR*/
-} lv_indev_data_t;
-#endif
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * GLOBAL PROTOTYPES
- **********************/
-void
-xpt2046_init(void);
-bool
-xpt2046_read(lv_indev_data_t *data);
-
-/**********************
- * MACROS
- **********************/
-
-#endif /* USE_XPT2046 */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* XPT2046_H */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/board_config.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/board_config.h
deleted file mode 100644
index d7ea279a9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/board_config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __BOARD_CONFIG_H__
-#define __BOARD_CONFIG_H__
-#include "pin_config_stm32.h"
-
-#endif /* __BOARD_CONFIG_H__ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display.h
deleted file mode 100644
index c6657a40a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display.h
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/**
- * @file
- * @brief Public API for display drivers and applications
- */
-
-#ifndef ZEPHYR_INCLUDE_DISPLAY_H_
-#define ZEPHYR_INCLUDE_DISPLAY_H_
-
-/**
- * @brief Display Interface
- * @defgroup display_interface Display Interface
- * @ingroup display_interfaces
- * @{
- */
-
-#include <device.h>
-#include <stddef.h>
-#include <zephyr/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum display_pixel_format {
- PIXEL_FORMAT_RGB_888 = BIT(0),
- PIXEL_FORMAT_MONO01 = BIT(1), /* 0=Black 1=White */
- PIXEL_FORMAT_MONO10 = BIT(2), /* 1=Black 0=White */
- PIXEL_FORMAT_ARGB_8888 = BIT(3),
- PIXEL_FORMAT_RGB_565 = BIT(4),
-};
-
-enum display_screen_info {
- /**
- * If selected, one octet represents 8 pixels ordered vertically,
- * otherwise ordered horizontally.
- */
- SCREEN_INFO_MONO_VTILED = BIT(0),
- /**
- * If selected, the MSB represents the first pixel,
- * otherwise MSB represents the last pixel.
- */
- SCREEN_INFO_MONO_MSB_FIRST = BIT(1),
- /**
- * Electrophoretic Display.
- */
- SCREEN_INFO_EPD = BIT(2),
- /**
- * Screen has two alternating ram buffers
- */
- SCREEN_INFO_DOUBLE_BUFFER = BIT(3),
-};
-
-/**
- * @enum display_orientation
- * @brief Enumeration with possible display orientation
- *
- */
-enum display_orientation {
- DISPLAY_ORIENTATION_NORMAL,
- DISPLAY_ORIENTATION_ROTATED_90,
- DISPLAY_ORIENTATION_ROTATED_180,
- DISPLAY_ORIENTATION_ROTATED_270,
-};
-
-/**
- * @struct display_capabilities
- * @brief Structure holding display capabilities
- *
- * @var u16_t display_capabilities::x_resolution
- * Display resolution in the X direction
- *
- * @var u16_t display_capabilities::y_resolution
- * Display resolution in the Y direction
- *
- * @var u32_t display_capabilities::supported_pixel_formats
- * Bitwise or of pixel formats supported by the display
- *
- * @var u32_t display_capabilities::screen_info
- * Information about display panel
- *
- * @var enum display_pixel_format display_capabilities::current_pixel_format
- * Currently active pixel format for the display
- *
- * @var enum display_orientation display_capabilities::current_orientation
- * Current display orientation
- *
- */
-struct display_capabilities {
- uint16_t x_resolution;
- uint16_t y_resolution;
- uint32_t supported_pixel_formats;
- uint32_t screen_info;
- enum display_pixel_format current_pixel_format;
- enum display_orientation current_orientation;
-};
-
-/**
- * @struct display_buffer_descriptor
- * @brief Structure to describe display data buffer layout
- *
- * @var u32_t display_buffer_descriptor::buf_size
- * Data buffer size in bytes
- *
- * @var u16_t display_buffer_descriptor::width
- * Data buffer row width in pixels
- *
- * @var u16_t display_buffer_descriptor::height
- * Data buffer column height in pixels
- *
- * @var u16_t display_buffer_descriptor::pitch
- * Number of pixels between consecutive rows in the data buffer
- *
- */
-struct display_buffer_descriptor {
- uint32_t buf_size;
- uint16_t width;
- uint16_t height;
- uint16_t pitch;
-};
-
-/**
- * @typedef display_blanking_on_api
- * @brief Callback API to turn on display blanking
- * See display_blanking_on() for argument description
- */
-typedef int (*display_blanking_on_api)(const struct device *dev);
-
-/**
- * @typedef display_blanking_off_api
- * @brief Callback API to turn off display blanking
- * See display_blanking_off() for argument description
- */
-typedef int (*display_blanking_off_api)(const struct device *dev);
-
-/**
- * @typedef display_write_api
- * @brief Callback API for writing data to the display
- * See display_write() for argument description
- */
-typedef int (*display_write_api)(const struct device *dev, const uint16_t x,
- const uint16_t y,
- const struct display_buffer_descriptor *desc,
- const void *buf);
-
-/**
- * @typedef display_read_api
- * @brief Callback API for reading data from the display
- * See display_read() for argument description
- */
-typedef int (*display_read_api)(const struct device *dev, const uint16_t x,
- const uint16_t y,
- const struct display_buffer_descriptor *desc,
- void *buf);
-
-/**
- * @typedef display_get_framebuffer_api
- * @brief Callback API to get framebuffer pointer
- * See display_get_framebuffer() for argument description
- */
-typedef void *(*display_get_framebuffer_api)(const struct device *dev);
-
-/**
- * @typedef display_set_brightness_api
- * @brief Callback API to set display brightness
- * See display_set_brightness() for argument description
- */
-typedef int (*display_set_brightness_api)(const struct device *dev,
- const uint8_t brightness);
-
-/**
- * @typedef display_set_contrast_api
- * @brief Callback API to set display contrast
- * See display_set_contrast() for argument description
- */
-typedef int (*display_set_contrast_api)(const struct device *dev,
- const uint8_t contrast);
-
-/**
- * @typedef display_get_capabilities_api
- * @brief Callback API to get display capabilities
- * See display_get_capabilities() for argument description
- */
-typedef void (*display_get_capabilities_api)(
- const struct device *dev, struct display_capabilities *capabilities);
-
-/**
- * @typedef display_set_pixel_format_api
- * @brief Callback API to set pixel format used by the display
- * See display_set_pixel_format() for argument description
- */
-typedef int (*display_set_pixel_format_api)(
- const struct device *dev, const enum display_pixel_format pixel_format);
-
-/**
- * @typedef display_set_orientation_api
- * @brief Callback API to set orientation used by the display
- * See display_set_orientation() for argument description
- */
-typedef int (*display_set_orientation_api)(
- const struct device *dev, const enum display_orientation orientation);
-
-/**
- * @brief Display driver API
- * API which a display driver should expose
- */
-struct display_driver_api {
- display_blanking_on_api blanking_on;
- display_blanking_off_api blanking_off;
- display_write_api write;
- display_read_api read;
- display_get_framebuffer_api get_framebuffer;
- display_set_brightness_api set_brightness;
- display_set_contrast_api set_contrast;
- display_get_capabilities_api get_capabilities;
- display_set_pixel_format_api set_pixel_format;
- display_set_orientation_api set_orientation;
-};
-extern struct ili9340_data ili9340_data1;
-extern struct display_driver_api ili9340_api1;
-/**
- * @brief Write data to display
- *
- * @param dev Pointer to device structure
- * @param x x Coordinate of the upper left corner where to write the buffer
- * @param y y Coordinate of the upper left corner where to write the buffer
- * @param desc Pointer to a structure describing the buffer layout
- * @param buf Pointer to buffer array
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_write(const struct device *dev, const uint16_t x, const uint16_t y,
- const struct display_buffer_descriptor *desc, const void *buf)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->write(dev, x, y, desc, buf);
-}
-
-/**
- * @brief Read data from display
- *
- * @param dev Pointer to device structure
- * @param x x Coordinate of the upper left corner where to read from
- * @param y y Coordinate of the upper left corner where to read from
- * @param desc Pointer to a structure describing the buffer layout
- * @param buf Pointer to buffer array
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_read(const struct device *dev, const uint16_t x, const uint16_t y,
- const struct display_buffer_descriptor *desc, void *buf)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->read(dev, x, y, desc, buf);
-}
-
-/**
- * @brief Get pointer to framebuffer for direct access
- *
- * @param dev Pointer to device structure
- *
- * @retval Pointer to frame buffer or NULL if direct framebuffer access
- * is not supported
- *
- */
-static inline void *
-display_get_framebuffer(const struct device *dev)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->get_framebuffer(dev);
-}
-
-/**
- * @brief Turn display blanking on
- *
- * @param dev Pointer to device structure
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_blanking_on(const struct device *dev)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->blanking_on(dev);
-}
-
-/**
- * @brief Turn display blanking off
- *
- * @param dev Pointer to device structure
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_blanking_off(const struct device *dev)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->blanking_off(dev);
-}
-
-/**
- * @brief Set the brightness of the display
- *
- * Set the brightness of the display in steps of 1/256, where 255 is full
- * brightness and 0 is minimal.
- *
- * @param dev Pointer to device structure
- * @param brightness Brightness in steps of 1/256
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_brightness(const struct device *dev, uint8_t brightness)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_brightness(dev, brightness);
-}
-
-/**
- * @brief Set the contrast of the display
- *
- * Set the contrast of the display in steps of 1/256, where 255 is maximum
- * difference and 0 is minimal.
- *
- * @param dev Pointer to device structure
- * @param contrast Contrast in steps of 1/256
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_contrast(const struct device *dev, uint8_t contrast)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_contrast(dev, contrast);
-}
-
-/**
- * @brief Get display capabilities
- *
- * @param dev Pointer to device structure
- * @param capabilities Pointer to capabilities structure to populate
- */
-static inline void
-display_get_capabilities(const struct device *dev,
- struct display_capabilities *capabilities)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- api->get_capabilities(dev, capabilities);
-}
-
-/**
- * @brief Set pixel format used by the display
- *
- * @param dev Pointer to device structure
- * @param pixel_format Pixel format to be used by display
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_pixel_format(const struct device *dev,
- const enum display_pixel_format pixel_format)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_pixel_format(dev, pixel_format);
-}
-
-/**
- * @brief Set display orientation
- *
- * @param dev Pointer to device structure
- * @param orientation Orientation to be used by display
- *
- * @retval 0 on success else negative errno code.
- */
-static inline int
-display_set_orientation(const struct device *dev,
- const enum display_orientation orientation)
-{
- struct display_driver_api *api = &ili9340_api1;
- //(struct display_driver_api *)dev->driver_api;
-
- return api->set_orientation(dev, orientation);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-
-#endif /* ZEPHYR_INCLUDE_DISPLAY_H_*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.c
deleted file mode 100644
index e5b0d771a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "display_ili9340.h"
-#include <display.h>
-
-//#define LOG_LEVEL CONFIG_DISPLAY_LOG_LEVEL
-//#include <logging/log.h>
-// LOG_MODULE_REGISTER(display_ili9340);
-#define LOG_ERR printf
-#define LOG_DBG printf
-#define LOG_WRN printf
-
-#include <drivers/gpio.h>
-#include <sys/byteorder.h>
-#include <drivers/spi.h>
-#include <string.h>
-#include <stdio.h>
-
-struct ili9340_data {
- struct device *reset_gpio;
- struct device *command_data_gpio;
- struct device *spi_dev;
- struct spi_config spi_config;
-#ifdef DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER
- struct spi_cs_control cs_ctrl;
-#endif
-};
-
-struct ili9340_data ili9340_data1;
-
-#define ILI9340_CMD_DATA_PIN_COMMAND 0
-#define ILI9340_CMD_DATA_PIN_DATA 1
-
-static void
-ili9340_exit_sleep(struct ili9340_data *data)
-{
- ili9340_transmit(data, ILI9340_CMD_EXIT_SLEEP, NULL, 0);
- // k_sleep(Z_TIMEOUT_MS(120));
-}
-
-int
-ili9340_init()
-{
- struct ili9340_data *data = &ili9340_data1;
-
- printf("Initializing display driver\n");
- data->spi_dev = device_get_binding(DT_ILITEK_ILI9340_0_BUS_NAME);
- if (data->spi_dev == NULL) {
- return -EPERM;
- }
- data->spi_config.frequency = DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY;
- data->spi_config.operation =
- SPI_OP_MODE_MASTER
- | SPI_WORD_SET(8); // SPI_OP_MODE_MASTER | SPI_WORD_SET(8);
- data->spi_config.slave = DT_ILITEK_ILI9340_0_BASE_ADDRESS;
-
-#ifdef DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER
- data->cs_ctrl.gpio_dev =
- device_get_binding(DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER);
- data->cs_ctrl.gpio_pin = DT_ILITEK_ILI9340_0_CS_GPIO_PIN;
- data->cs_ctrl.delay = 0;
- data->spi_config.cs = &(data->cs_ctrl);
-#else
- data->spi_config.cs = NULL;
-#endif
- data->reset_gpio =
- device_get_binding(DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER);
- if (data->reset_gpio == NULL) {
- return -EPERM;
- }
-
- gpio_pin_configure(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN,
- GPIO_OUTPUT);
-
- data->command_data_gpio =
- device_get_binding(DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER);
- if (data->command_data_gpio == NULL) {
- return -EPERM;
- }
-
- gpio_pin_configure(data->command_data_gpio,
- DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN, GPIO_OUTPUT);
-
- LOG_DBG("Resetting display driver\n");
- gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
- k_sleep(Z_TIMEOUT_MS(1));
- gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
- k_sleep(Z_TIMEOUT_MS(1));
- gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
- k_sleep(Z_TIMEOUT_MS(5));
-
- LOG_DBG("Initializing LCD\n");
- ili9340_lcd_init(data);
-
- LOG_DBG("Exiting sleep mode\n");
- ili9340_exit_sleep(data);
-
- return 0;
-}
-
-static void
-ili9340_set_mem_area(struct ili9340_data *data, const uint16_t x,
- const uint16_t y, const uint16_t w, const uint16_t h)
-{
- uint16_t spi_data[2];
-
- spi_data[0] = sys_cpu_to_be16(x);
- spi_data[1] = sys_cpu_to_be16(x + w - 1);
- ili9340_transmit(data, ILI9340_CMD_COLUMN_ADDR, &spi_data[0], 4);
-
- spi_data[0] = sys_cpu_to_be16(y);
- spi_data[1] = sys_cpu_to_be16(y + h - 1);
- ili9340_transmit(data, ILI9340_CMD_PAGE_ADDR, &spi_data[0], 4);
-}
-
-static int
-ili9340_write(const struct device *dev, const uint16_t x, const uint16_t y,
- const struct display_buffer_descriptor *desc, const void *buf)
-{
- struct ili9340_data *data = (struct ili9340_data *)&ili9340_data1;
- const uint8_t *write_data_start = (uint8_t *)buf;
- struct spi_buf tx_buf;
- struct spi_buf_set tx_bufs;
- uint16_t write_cnt;
- uint16_t nbr_of_writes;
- uint16_t write_h;
-
- __ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
- __ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size,
- "Input buffer to small");
- ili9340_set_mem_area(data, x, y, desc->width, desc->height);
-
- if (desc->pitch > desc->width) {
- write_h = 1U;
- nbr_of_writes = desc->height;
- }
- else {
- write_h = desc->height;
- nbr_of_writes = 1U;
- }
- ili9340_transmit(data, ILI9340_CMD_MEM_WRITE, (void *)write_data_start,
- 3 * desc->width * write_h);
-
- tx_bufs.buffers = &tx_buf;
- tx_bufs.count = 1;
-
- write_data_start += (3 * desc->pitch);
- for (write_cnt = 1U; write_cnt < nbr_of_writes; ++write_cnt) {
- tx_buf.buf = (void *)write_data_start;
- tx_buf.len = 3 * desc->width * write_h;
- spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
- write_data_start += (3 * desc->pitch);
- }
-
- return 0;
-}
-
-static int
-ili9340_read(const struct device *dev, const uint16_t x, const uint16_t y,
- const struct display_buffer_descriptor *desc, void *buf)
-{
- LOG_ERR("Reading not supported\n");
- return -ENOTSUP;
-}
-
-static void *
-ili9340_get_framebuffer(const struct device *dev)
-{
- LOG_ERR("Direct framebuffer access not supported\n");
- return NULL;
-}
-
-static int
-ili9340_display_blanking_off(const struct device *dev)
-{
- struct ili9340_data *data = (struct ili9340_data *)dev->driver_data;
-
- LOG_DBG("Turning display blanking off\n");
- ili9340_transmit(data, ILI9340_CMD_DISPLAY_ON, NULL, 0);
- return 0;
-}
-
-static int
-ili9340_display_blanking_on(const struct device *dev)
-{
- struct ili9340_data *data = (struct ili9340_data *)dev->driver_data;
-
- LOG_DBG("Turning display blanking on\n");
- ili9340_transmit(data, ILI9340_CMD_DISPLAY_OFF, NULL, 0);
- return 0;
-}
-
-static int
-ili9340_set_brightness(const struct device *dev, const uint8_t brightness)
-{
- LOG_WRN("Set brightness not implemented\n");
- return -ENOTSUP;
-}
-
-static int
-ili9340_set_contrast(const struct device *dev, const uint8_t contrast)
-{
- LOG_ERR("Set contrast not supported\n");
- return -ENOTSUP;
-}
-
-static int
-ili9340_set_pixel_format(const struct device *dev,
- const enum display_pixel_format pixel_format)
-{
- if (pixel_format == PIXEL_FORMAT_RGB_888) {
- return 0;
- }
- LOG_ERR("Pixel format change not implemented\n");
- return -ENOTSUP;
-}
-
-static int
-ili9340_set_orientation(const struct device *dev,
- const enum display_orientation orientation)
-{
- if (orientation == DISPLAY_ORIENTATION_NORMAL) {
- return 0;
- }
- LOG_ERR("Changing display orientation not implemented\n");
- return -ENOTSUP;
-}
-
-static void
-ili9340_get_capabilities(const struct device *dev,
- struct display_capabilities *capabilities)
-{
- memset(capabilities, 0, sizeof(struct display_capabilities));
- capabilities->x_resolution = 320;
- capabilities->y_resolution = 240;
- capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_888;
- capabilities->current_pixel_format = PIXEL_FORMAT_RGB_888;
- capabilities->current_orientation = DISPLAY_ORIENTATION_NORMAL;
-}
-
-void
-ili9340_transmit(struct ili9340_data *data, uint8_t cmd, void *tx_data,
- size_t tx_len)
-{
- struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
- struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
-
- data = (struct ili9340_data *)&ili9340_data1;
- gpio_pin_set(data->command_data_gpio,
- DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
- ILI9340_CMD_DATA_PIN_COMMAND);
- spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
- if (tx_data != NULL) {
- tx_buf.buf = tx_data;
- tx_buf.len = tx_len;
- gpio_pin_set(data->command_data_gpio,
- DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
- ILI9340_CMD_DATA_PIN_DATA);
- spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
- }
-}
-
-struct display_driver_api ili9340_api1 = {
- .blanking_on = ili9340_display_blanking_on,
- .blanking_off = ili9340_display_blanking_off,
- .write = ili9340_write,
- .read = ili9340_read,
- .get_framebuffer = ili9340_get_framebuffer,
- .set_brightness = ili9340_set_brightness,
- .set_contrast = ili9340_set_contrast,
- .get_capabilities = ili9340_get_capabilities,
- .set_pixel_format = ili9340_set_pixel_format,
- .set_orientation = ili9340_set_orientation
-};
-
-/*
-DEVICE_AND_API_INIT(ili9340, DT_ILITEK_ILI9340_0_LABEL, &ili9340_init,
- &ili9340_data, NULL, APPLICATION,
- CONFIG_APPLICATION_INIT_PRIORITY, &ili9340_api);
-*/
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h
deleted file mode 100644
index 4eb11e2d1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-#ifndef ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_
-#define ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_
-#include "board_config.h"
-#include <autoconf.h>
-#include <zephyr.h>
-
-#define ILI9340_CMD_ENTER_SLEEP 0x10
-#define ILI9340_CMD_EXIT_SLEEP 0x11
-#define ILI9340_CMD_GAMMA_SET 0x26
-#define ILI9340_CMD_DISPLAY_OFF 0x28
-#define ILI9340_CMD_DISPLAY_ON 0x29
-#define ILI9340_CMD_COLUMN_ADDR 0x2a
-#define ILI9340_CMD_PAGE_ADDR 0x2b
-#define ILI9340_CMD_MEM_WRITE 0x2c
-#define ILI9340_CMD_MEM_ACCESS_CTRL 0x36
-#define ILI9340_CMD_PIXEL_FORMAT_SET 0x3A
-#define ILI9340_CMD_FRAME_CTRL_NORMAL_MODE 0xB1
-#define ILI9340_CMD_DISPLAY_FUNCTION_CTRL 0xB6
-#define ILI9340_CMD_POWER_CTRL_1 0xC0
-#define ILI9340_CMD_POWER_CTRL_2 0xC1
-#define ILI9340_CMD_VCOM_CTRL_1 0xC5
-#define ILI9340_CMD_VCOM_CTRL_2 0xC7
-#define ILI9340_CMD_POSITVE_GAMMA_CORRECTION 0xE0
-#define ILI9340_CMD_NEGATIVE_GAMMA_CORRECTION 0xE1
-
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MY 0x80
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MX 0x40
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MV 0x20
-#define ILI9340_DATA_MEM_ACCESS_CTRL_ML 0x10
-#define ILI9340_DATA_MEM_ACCESS_CTRL_BGR 0x08
-#define ILI9340_DATA_MEM_ACCESS_CTRL_MH 0x04
-
-#define ILI9340_DATA_PIXEL_FORMAT_RGB_18_BIT 0x60
-#define ILI9340_DATA_PIXEL_FORMAT_RGB_16_BIT 0x50
-#define ILI9340_DATA_PIXEL_FORMAT_MCU_18_BIT 0x06
-#define ILI9340_DATA_PIXEL_FORMAT_MCU_16_BIT 0x05
-
-struct ili9340_data;
-
-/**
- * Send data to ILI9340 display controller
- *
- * @param data Device data structure
- * @param cmd Command to send to display controller
- * @param tx_data Data to transmit to the display controller
- * In case no data should be transmitted pass a NULL pointer
- * @param tx_len Number of bytes in tx_data buffer
- *
- */
-void
-ili9340_transmit(struct ili9340_data *data, uint8_t cmd, void *tx_data,
- size_t tx_len);
-
-/**
- * Perform LCD specific initialization
- *
- * @param data Device data structure
- */
-void
-ili9340_lcd_init(struct ili9340_data *data);
-
-#define DT_ILITEK_ILI9340_0_LABEL "DISPLAY"
-#define CONFIG_DISPLAY_LOG_LEVEL 0
-
-#endif /* ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340_adafruit_1480.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340_adafruit_1480.c
deleted file mode 100644
index 65aa618b5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340_adafruit_1480.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2017 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#include "display_ili9340.h"
-
-void
-ili9340_lcd_init(struct ili9340_data *data)
-{
- uint8_t tx_data[15];
-
- tx_data[0] = 0x23;
- ili9340_transmit(data, ILI9340_CMD_POWER_CTRL_1, tx_data, 1);
-
- tx_data[0] = 0x10;
- ili9340_transmit(data, ILI9340_CMD_POWER_CTRL_2, tx_data, 1);
-
- tx_data[0] = 0x3e;
- tx_data[1] = 0x28;
- ili9340_transmit(data, ILI9340_CMD_VCOM_CTRL_1, tx_data, 2);
-
- tx_data[0] = 0x86;
- ili9340_transmit(data, ILI9340_CMD_VCOM_CTRL_2, tx_data, 1);
-
- tx_data[0] =
- ILI9340_DATA_MEM_ACCESS_CTRL_MV | ILI9340_DATA_MEM_ACCESS_CTRL_BGR;
- ili9340_transmit(data, ILI9340_CMD_MEM_ACCESS_CTRL, tx_data, 1);
-
- tx_data[0] = ILI9340_DATA_PIXEL_FORMAT_MCU_18_BIT
- | ILI9340_DATA_PIXEL_FORMAT_RGB_18_BIT;
- ili9340_transmit(data, ILI9340_CMD_PIXEL_FORMAT_SET, tx_data, 1);
-
- tx_data[0] = 0x00;
- tx_data[1] = 0x18;
- ili9340_transmit(data, ILI9340_CMD_FRAME_CTRL_NORMAL_MODE, tx_data, 2);
-
- tx_data[0] = 0x08;
- tx_data[1] = 0x82;
- tx_data[2] = 0x27;
- ili9340_transmit(data, ILI9340_CMD_DISPLAY_FUNCTION_CTRL, tx_data, 3);
-
- tx_data[0] = 0x01;
- ili9340_transmit(data, ILI9340_CMD_GAMMA_SET, tx_data, 1);
-
- tx_data[0] = 0x0F;
- tx_data[1] = 0x31;
- tx_data[2] = 0x2B;
- tx_data[3] = 0x0C;
- tx_data[4] = 0x0E;
- tx_data[5] = 0x08;
- tx_data[6] = 0x4E;
- tx_data[7] = 0xF1;
- tx_data[8] = 0x37;
- tx_data[9] = 0x07;
- tx_data[10] = 0x10;
- tx_data[11] = 0x03;
- tx_data[12] = 0x0E;
- tx_data[13] = 0x09;
- tx_data[14] = 0x00;
- ili9340_transmit(data, ILI9340_CMD_POSITVE_GAMMA_CORRECTION, tx_data, 15);
-
- tx_data[0] = 0x00;
- tx_data[1] = 0x0E;
- tx_data[2] = 0x14;
- tx_data[3] = 0x03;
- tx_data[4] = 0x11;
- tx_data[5] = 0x07;
- tx_data[6] = 0x31;
- tx_data[7] = 0xC1;
- tx_data[8] = 0x48;
- tx_data[9] = 0x08;
- tx_data[10] = 0x0F;
- tx_data[11] = 0x0C;
- tx_data[12] = 0x31;
- tx_data[13] = 0x36;
- tx_data[14] = 0x0F;
- ili9340_transmit(data, ILI9340_CMD_NEGATIVE_GAMMA_CORRECTION, tx_data, 15);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_indev.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_indev.c
deleted file mode 100644
index b2f9f8e52..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_indev.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include <stdio.h>
-#include <stdbool.h>
-#include "display_indev.h"
-#include "display.h"
-#include "wasm_export.h"
-#include "app_manager_export.h"
-
-#define MONITOR_HOR_RES 320
-#define MONITOR_VER_RES 240
-#ifndef MONITOR_ZOOM
-#define MONITOR_ZOOM 1
-#endif
-
-extern int
-ili9340_init();
-
-static int lcd_initialized = 0;
-
-void
-display_init(void)
-{
- if (lcd_initialized != 0) {
- return;
- }
- lcd_initialized = 1;
- xpt2046_init();
- ili9340_init();
- display_blanking_off(NULL);
-}
-
-void
-display_flush(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, lv_color_t *color)
-{
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- struct display_buffer_descriptor desc;
-
- if (!wasm_runtime_validate_native_addr(module_inst, color,
- sizeof(lv_color_t)))
- return;
-
- uint16_t w = x2 - x1 + 1;
- uint16_t h = y2 - y1 + 1;
-
- desc.buf_size = 3 * w * h;
- desc.width = w;
- desc.pitch = w;
- desc.height = h;
- display_write(NULL, x1, y1, &desc, (void *)color);
-
- /*lv_flush_ready();*/
-}
-
-void
-display_fill(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, lv_color_t *color)
-{}
-
-void
-display_map(wasm_exec_env_t exec_env, int32_t x1, int32_t y1, int32_t x2,
- int32_t y2, const lv_color_t *color)
-{}
-
-bool
-display_input_read(wasm_exec_env_t exec_env, void *data)
-{
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- lv_indev_data_t *lv_data = (lv_indev_data_t *)data;
-
- if (!wasm_runtime_validate_native_addr(module_inst, lv_data,
- sizeof(lv_indev_data_t)))
- return false;
-
- return touchscreen_read(lv_data);
-}
-
-void
-display_deinit(wasm_exec_env_t exec_env)
-{}
-
-void
-display_vdb_write(wasm_exec_env_t exec_env, void *buf, lv_coord_t buf_w,
- lv_coord_t x, lv_coord_t y, lv_color_t *color, lv_opa_t opa)
-{
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- uint8_t *buf_xy = (uint8_t *)buf + 3 * x + 3 * y * buf_w;
-
- if (!wasm_runtime_validate_native_addr(module_inst, color,
- sizeof(lv_color_t)))
- return;
-
- *buf_xy = color->red;
- *(buf_xy + 1) = color->green;
- *(buf_xy + 2) = color->blue;
-}
-
-int
-time_get_ms(wasm_exec_env_t exec_env)
-{
- return k_uptime_get_32();
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c
deleted file mode 100644
index dceb5786b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include "bh_platform.h"
-#include "runtime_lib.h"
-#include "native_interface.h"
-#include "app_manager_export.h"
-#include "board_config.h"
-#include "bh_platform.h"
-#include "runtime_sensor.h"
-#include "bi-inc/attr_container.h"
-#include "module_wasm_app.h"
-#include "wasm_export.h"
-#include "sensor_native_api.h"
-#include "connection_native_api.h"
-#include "display_indev.h"
-
-#include <zephyr.h>
-#include <drivers/uart.h>
-#include <device.h>
-
-extern bool
-init_sensor_framework();
-extern void
-exit_sensor_framework();
-extern int
-aee_host_msg_callback(void *msg, uint32_t msg_len);
-
-int uart_char_cnt = 0;
-
-static void
-uart_irq_callback(const struct device *dev, void *user_data)
-{
- unsigned char ch;
-
- while (uart_poll_in(dev, &ch) == 0) {
- uart_char_cnt++;
- aee_host_msg_callback(&ch, 1);
- }
- (void)user_data;
-}
-
-const struct device *uart_dev = NULL;
-
-static bool
-host_init()
-{
- uart_dev = device_get_binding(HOST_DEVICE_COMM_UART_NAME);
- if (!uart_dev) {
- printf("UART: Device driver not found.\n");
- return false;
- }
- uart_irq_rx_enable(uart_dev);
- uart_irq_callback_set(uart_dev, uart_irq_callback);
- return true;
-}
-
-int
-host_send(void *ctx, const char *buf, int size)
-{
- if (!uart_dev)
- return 0;
-
- for (int i = 0; i < size; i++)
- uart_poll_out(uart_dev, buf[i]);
-
- return size;
-}
-
-void
-host_destroy()
-{}
-
-/* clang-format off */
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-/* clang-format on */
-
-timer_ctx_t timer_ctx;
-
-static char global_heap_buf[350 * 1024] = { 0 };
-
-static NativeSymbol native_symbols[] = {
- EXPORT_WASM_API_WITH_SIG(display_input_read, "(*)i"),
- EXPORT_WASM_API_WITH_SIG(display_flush, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(display_fill, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(display_vdb_write, "(*iii*i)"),
- EXPORT_WASM_API_WITH_SIG(display_map, "(iiii*)"),
- EXPORT_WASM_API_WITH_SIG(time_get_ms, "()i")
-};
-
-int
-iwasm_main()
-{
- RuntimeInitArgs init_args;
-
- host_init();
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- init_args.native_module_name = "env";
- init_args.n_native_symbols = sizeof(native_symbols) / sizeof(NativeSymbol);
- init_args.native_symbols = native_symbols;
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- display_init();
-
- /* timer manager */
- if (!init_wasm_timer()) {
- goto fail;
- }
-
- app_manager_startup(&interface);
-
-fail:
- wasm_runtime_destroy();
- return -1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/main.c
deleted file mode 100644
index c331306ed..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/main.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "bh_platform.h"
-#include "bh_assert.h"
-#include "bh_log.h"
-#include "wasm_export.h"
-
-extern void
-display_init(void);
-extern int
-iwasm_main();
-
-void
-main(void)
-{
- display_init();
- iwasm_main();
- for (;;) {
- k_sleep(Z_TIMEOUT_MS(1000));
- }
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_jlf.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_jlf.h
deleted file mode 100644
index bb20ecbb8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_jlf.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __PIN_CONFIG_JLF_H__
-#define __PIN_CONFIG_JLF_H__
-
-#define DT_ILITEK_ILI9340_0_BUS_NAME "SPI_2"
-#define DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY 10 * 1000
-
-#define DT_ILITEK_ILI9340_0_BASE_ADDRESS 1
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER "GPIO_0"
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN 5
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER "GPIO_0"
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN 4
-
-#define XPT2046_SPI_DEVICE_NAME "SPI_2"
-#define XPT2046_SPI_MAX_FREQUENCY 10 * 1000
-#define XPT2046_CS_GPIO_CONTROLLER "GPIO_0"
-#define XPT2046_CS_GPIO_PIN 6
-
-#define XPT2046_PEN_GPIO_CONTROLLER "GPIO_0"
-#define XPT2046_PEN_GPIO_PIN 7
-
-#define HOST_DEVICE_COMM_UART_NAME "UART_1"
-#endif /* __PIN_CONFIG_JLF_H__ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_stm32.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_stm32.h
deleted file mode 100644
index 523ce2308..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/pin_config_stm32.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __PIN_CONFIG_STM32_H__
-#define __PIN_CONFIG_STM32_H__
-
-#define DT_ILITEK_ILI9340_0_BUS_NAME "SPI_1"
-#define DT_ILITEK_ILI9340_0_SPI_MAX_FREQUENCY 24 * 1000 * 1000
-
-#define DT_ILITEK_ILI9340_0_BASE_ADDRESS 1
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER "GPIOC"
-#define DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN 12
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER "GPIOC"
-#define DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN 11
-
-#define DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER "GPIOC"
-#define DT_ILITEK_ILI9340_0_CS_GPIO_PIN 10
-
-#define XPT2046_SPI_DEVICE_NAME "SPI_1"
-#define XPT2046_SPI_MAX_FREQUENCY 12 * 1000 * 1000
-#define XPT2046_CS_GPIO_CONTROLLER "GPIOD"
-#define XPT2046_CS_GPIO_PIN 0
-
-#define XPT2046_PEN_GPIO_CONTROLLER "GPIOD"
-#define XPT2046_PEN_GPIO_PIN 1
-
-#define HOST_DEVICE_COMM_UART_NAME "UART_6"
-
-#endif /* __PIN_CONFIG_STM32_H__ */
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wamr_config_littlevgl.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wamr_config_littlevgl.cmake
deleted file mode 100644
index 7a9065ab5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wamr_config_littlevgl.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 1)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_SENSOR WAMR_APP_BUILD_CONNECTION)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app
deleted file mode 100644
index 8c053cc6d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-CC = /opt/wasi-sdk/bin/clang
-LVGL_DIR = ${shell pwd}
-SDK_DIR = $(LVGL_DIR)/../../../wamr-sdk/out/littlevgl/app-sdk
-APP_FRAMEWORK_DIR = $(SDK_DIR)/wamr-app-framework
-LVGL_REPO_PATH=../build/lvgl
-
-CFLAGS += -O3 \
- -I$(LVGL_DIR) \
- -I$(LVGL_DIR)/../build \
- -I$(LVGL_DIR)/lv_drivers \
- -I$(LVGL_DIR)/src \
- -I$(LVGL_DIR)/../lv_config \
- -I$(APP_FRAMEWORK_DIR)/include
-
-SRCS += ${LVGL_REPO_PATH}/lv_draw/lv_draw_line.c ${LVGL_REPO_PATH}/lv_draw/lv_draw_rbasic.c
-SRCS += ${LVGL_REPO_PATH}/lv_draw/lv_draw_img.c ${LVGL_REPO_PATH}/lv_draw/lv_draw_arc.c
-SRCS += ${LVGL_REPO_PATH}/lv_draw/lv_draw_rect.c ${LVGL_REPO_PATH}/lv_draw/lv_draw_triangle.c
-SRCS += ${LVGL_REPO_PATH}/lv_draw/lv_draw.c ${LVGL_REPO_PATH}/lv_draw/lv_draw_label.c
-SRCS += ${LVGL_REPO_PATH}/lv_draw/lv_draw_vbasic.c ${LVGL_REPO_PATH}/lv_fonts/lv_font_builtin.c
-SRCS += ${LVGL_REPO_PATH}/lv_fonts/lv_font_dejavu_20.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_img.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_roller.c ${LVGL_REPO_PATH}/lv_objx/lv_cb.c ${LVGL_REPO_PATH}/lv_objx/lv_led.c ${LVGL_REPO_PATH}/lv_objx/lv_cont.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_calendar.c ${LVGL_REPO_PATH}/lv_objx/lv_gauge.c ${LVGL_REPO_PATH}/lv_objx/lv_page.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_list.c ${LVGL_REPO_PATH}/lv_objx/lv_bar.c ${LVGL_REPO_PATH}/lv_objx/lv_tabview.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_mbox.c ${LVGL_REPO_PATH}/lv_objx/lv_objx_templ.c ${LVGL_REPO_PATH}/lv_objx/lv_sw.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_label.c ${LVGL_REPO_PATH}/lv_objx/lv_slider.c ${LVGL_REPO_PATH}/lv_objx/lv_ddlist.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_imgbtn.c ${LVGL_REPO_PATH}/lv_objx/lv_line.c ${LVGL_REPO_PATH}/lv_objx/lv_chart.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_btnm.c ${LVGL_REPO_PATH}/lv_objx/lv_arc.c ${LVGL_REPO_PATH}/lv_objx/lv_preload.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_win.c ${LVGL_REPO_PATH}/lv_objx/lv_lmeter.c ${LVGL_REPO_PATH}/lv_objx/lv_btn.c
-SRCS += ${LVGL_REPO_PATH}/lv_objx/lv_ta.c ${LVGL_REPO_PATH}/lv_misc/lv_log.c ${LVGL_REPO_PATH}/lv_misc/lv_fs.c
-SRCS += ${LVGL_REPO_PATH}/lv_misc/lv_task.c ${LVGL_REPO_PATH}/lv_misc/lv_circ.c ${LVGL_REPO_PATH}/lv_misc/lv_anim.c
-SRCS += ${LVGL_REPO_PATH}/lv_misc/lv_color.c ${LVGL_REPO_PATH}/lv_misc/lv_txt.c ${LVGL_REPO_PATH}/lv_misc/lv_math.c
-SRCS += ${LVGL_REPO_PATH}/lv_misc/lv_mem.c ${LVGL_REPO_PATH}/lv_misc/lv_font.c ${LVGL_REPO_PATH}/lv_misc/lv_ll.c
-SRCS += ${LVGL_REPO_PATH}/lv_misc/lv_area.c ${LVGL_REPO_PATH}/lv_misc/lv_templ.c ${LVGL_REPO_PATH}/lv_misc/lv_ufs.c
-SRCS += ${LVGL_REPO_PATH}/lv_misc/lv_gc.c
-SRCS += ${LVGL_REPO_PATH}/lv_hal/lv_hal_tick.c ${LVGL_REPO_PATH}/lv_hal/lv_hal_indev.c ${LVGL_REPO_PATH}/lv_hal/lv_hal_disp.c
-SRCS += ${LVGL_REPO_PATH}/lv_themes/lv_theme_mono.c ${LVGL_REPO_PATH}/lv_themes/lv_theme_templ.c
-SRCS += ${LVGL_REPO_PATH}/lv_themes/lv_theme_material.c ${LVGL_REPO_PATH}/lv_themes/lv_theme.c
-SRCS += ${LVGL_REPO_PATH}/lv_themes/lv_theme_night.c ${LVGL_REPO_PATH}/lv_themes/lv_theme_zen.c ${LVGL_REPO_PATH}/lv_themes/lv_theme_nemo.c
-SRCS += ${LVGL_REPO_PATH}/lv_themes/lv_theme_alien.c ${LVGL_REPO_PATH}/lv_themes/lv_theme_default.c
-SRCS += ${LVGL_REPO_PATH}/lv_core/lv_group.c ${LVGL_REPO_PATH}/lv_core/lv_style.c ${LVGL_REPO_PATH}/lv_core/lv_indev.c
-SRCS += ${LVGL_REPO_PATH}/lv_core/lv_vdb.c ${LVGL_REPO_PATH}/lv_core/lv_obj.c ${LVGL_REPO_PATH}/lv_core/lv_refr.c
-SRCS += $(LVGL_DIR)/src/main.c
-
-all:
- @$(CC) $(CFLAGS) $(SRCS) \
- -O3 -z stack-size=2048 -Wl,--initial-memory=65536 \
- -DLV_CONF_INCLUDE_SIMPLE \
- -L$(APP_FRAMEWORK_DIR)/lib -lapp_framework \
- -Wl,--allow-undefined \
- -Wl,--strip-all,--no-entry \
- -Wl,--export=on_init -Wl,--export=on_timer_callback \
- -Wl,--export=__heap_base,--export=__data_end \
- -o ui_app_wasi.wasm
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app_no_wasi b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app_no_wasi
deleted file mode 100644
index d18c0a222..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/Makefile_wasm_app_no_wasi
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-CC = /opt/wasi-sdk/bin/clang
-LVGL_DIR = ${shell pwd}
-WAMR_DIR = ${LVGL_DIR}/../../..
-SDK_DIR = $(LVGL_DIR)/../../../wamr-sdk/out/littlevgl/app-sdk
-APP_FRAMEWORK_DIR = $(SDK_DIR)/wamr-app-framework
-LVGL_REPO_PATH=../build/lvgl
-
-CFLAGS += -O3 \
- -I$(LVGL_DIR) \
- -I$(LVGL_DIR)/../build \
- -I$(LVGL_DIR)/lv_drivers \
- -I$(LVGL_DIR)/src \
- -I$(LVGL_DIR)/../lv_config \
- -I$(APP_FRAMEWORK_DIR)/include
-
-SRCS += $(LVGL_REPO_PATH)/lv_draw/lv_draw_line.c $(LVGL_REPO_PATH)/lv_draw/lv_draw_rbasic.c
-SRCS += $(LVGL_REPO_PATH)/lv_draw/lv_draw_img.c $(LVGL_REPO_PATH)/lv_draw/lv_draw_arc.c
-SRCS += $(LVGL_REPO_PATH)/lv_draw/lv_draw_rect.c $(LVGL_REPO_PATH)/lv_draw/lv_draw_triangle.c
-SRCS += $(LVGL_REPO_PATH)/lv_draw/lv_draw.c $(LVGL_REPO_PATH)/lv_draw/lv_draw_label.c
-SRCS += $(LVGL_REPO_PATH)/lv_draw/lv_draw_vbasic.c $(LVGL_REPO_PATH)/lv_fonts/lv_font_builtin.c
-SRCS += $(LVGL_REPO_PATH)/lv_fonts/lv_font_dejavu_20.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_img.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_roller.c $(LVGL_REPO_PATH)/lv_objx/lv_cb.c $(LVGL_REPO_PATH)/lv_objx/lv_led.c $(LVGL_REPO_PATH)/lv_objx/lv_cont.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_calendar.c $(LVGL_REPO_PATH)/lv_objx/lv_gauge.c $(LVGL_REPO_PATH)/lv_objx/lv_page.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_list.c $(LVGL_REPO_PATH)/lv_objx/lv_bar.c $(LVGL_REPO_PATH)/lv_objx/lv_tabview.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_mbox.c $(LVGL_REPO_PATH)/lv_objx/lv_objx_templ.c $(LVGL_REPO_PATH)/lv_objx/lv_sw.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_label.c $(LVGL_REPO_PATH)/lv_objx/lv_slider.c $(LVGL_REPO_PATH)/lv_objx/lv_ddlist.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_imgbtn.c $(LVGL_REPO_PATH)/lv_objx/lv_line.c $(LVGL_REPO_PATH)/lv_objx/lv_chart.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_btnm.c $(LVGL_REPO_PATH)/lv_objx/lv_arc.c $(LVGL_REPO_PATH)/lv_objx/lv_preload.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_win.c $(LVGL_REPO_PATH)/lv_objx/lv_lmeter.c $(LVGL_REPO_PATH)/lv_objx/lv_btn.c
-SRCS += $(LVGL_REPO_PATH)/lv_objx/lv_ta.c $(LVGL_REPO_PATH)/lv_misc/lv_log.c $(LVGL_REPO_PATH)/lv_misc/lv_fs.c
-SRCS += $(LVGL_REPO_PATH)/lv_misc/lv_task.c $(LVGL_REPO_PATH)/lv_misc/lv_circ.c $(LVGL_REPO_PATH)/lv_misc/lv_anim.c
-SRCS += $(LVGL_REPO_PATH)/lv_misc/lv_color.c $(LVGL_REPO_PATH)/lv_misc/lv_txt.c $(LVGL_REPO_PATH)/lv_misc/lv_math.c
-SRCS += $(LVGL_REPO_PATH)/lv_misc/lv_mem.c $(LVGL_REPO_PATH)/lv_misc/lv_font.c $(LVGL_REPO_PATH)/lv_misc/lv_ll.c
-SRCS += $(LVGL_REPO_PATH)/lv_misc/lv_area.c $(LVGL_REPO_PATH)/lv_misc/lv_templ.c $(LVGL_REPO_PATH)/lv_misc/lv_ufs.c
-SRCS += $(LVGL_REPO_PATH)/lv_misc/lv_gc.c
-SRCS += $(LVGL_REPO_PATH)/lv_hal/lv_hal_tick.c $(LVGL_REPO_PATH)/lv_hal/lv_hal_indev.c $(LVGL_REPO_PATH)/lv_hal/lv_hal_disp.c
-SRCS += $(LVGL_REPO_PATH)/lv_themes/lv_theme_mono.c $(LVGL_REPO_PATH)/lv_themes/lv_theme_templ.c
-SRCS += $(LVGL_REPO_PATH)/lv_themes/lv_theme_material.c $(LVGL_REPO_PATH)/lv_themes/lv_theme.c
-SRCS += $(LVGL_REPO_PATH)/lv_themes/lv_theme_night.c $(LVGL_REPO_PATH)/lv_themes/lv_theme_zen.c $(LVGL_REPO_PATH)/lv_themes/lv_theme_nemo.c
-SRCS += $(LVGL_REPO_PATH)/lv_themes/lv_theme_alien.c $(LVGL_REPO_PATH)/lv_themes/lv_theme_default.c
-SRCS += $(LVGL_REPO_PATH)/lv_core/lv_group.c $(LVGL_REPO_PATH)/lv_core/lv_style.c $(LVGL_REPO_PATH)/lv_core/lv_indev.c
-SRCS += $(LVGL_REPO_PATH)/lv_core/lv_vdb.c $(LVGL_REPO_PATH)/lv_core/lv_obj.c $(LVGL_REPO_PATH)/lv_core/lv_refr.c
-SRCS += $(LVGL_DIR)/src/main.c
-
-all:
- @$(CC) $(CFLAGS) $(SRCS) \
- --target=wasm32 -Wl,--allow-undefined \
- --sysroot=$(WAMR_DIR)/wamr-sdk/app/libc-builtin-sysroot \
- -O3 -z stack-size=2048 -Wl,--initial-memory=65536 \
- -DLV_CONF_INCLUDE_SIMPLE \
- -L$(APP_FRAMEWORK_DIR)/lib -lapp_framework \
- -Wl,--allow-undefined \
- -Wl,--strip-all,--no-entry -nostdlib \
- -Wl,--export=on_init -Wl,--export=on_timer_callback \
- -o ui_app_builtin_libc.wasm
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/build_wasm_app.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/build_wasm_app.sh
deleted file mode 100755
index a86784e2a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/build_wasm_app.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-WAMR_DIR=${PWD}/../../..
-
-if [ -z $KW_BUILD ] || [ -z $KW_OUT_FILE ];then
- echo "Local Build Env"
- makewrap="make"
-else
- echo "Klocwork Build Env"
- makewrap="kwinject -o $KW_OUT_FILE make"
-fi
-
-echo "make Makefile_wasm_app"
-$makewrap -f Makefile_wasm_app
-
-echo "make Makefile_wasm_app_no_wasi"
-$makewrap -f Makefile_wasm_app_no_wasi
-
-echo "completed." \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/display_indev.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/display_indev.h
deleted file mode 100644
index 9285699b6..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/display_indev.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#ifndef DISPLAY_INDEV_H_
-#define DISPLAY_INDEV_H_
-#include <stdio.h>
-#include <inttypes.h>
-
-#include "lvgl/lv_misc/lv_color.h"
-#include "lvgl/lv_hal/lv_hal_indev.h"
-
-extern void
-display_init(void);
-
-extern void
-display_deinit(void);
-
-extern void
-display_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color);
-
-extern bool
-display_input_read(lv_indev_data_t *data);
-
-extern void
-display_vdb_write(void *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
- lv_color_t *color, lv_opa_t opa);
-
-void
-display_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color);
-
-void
-display_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color);
-
-extern uint32_t
-time_get_ms(void);
-
-#endif
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/main.c
deleted file mode 100644
index 8676d41b5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/main.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-/**
- * @file main
- *
- */
-
-/*********************
- * INCLUDES
- *********************/
-#include <stdlib.h>
-//#include <unistd.h>
-#include <inttypes.h>
-#include "lvgl/lvgl.h"
-#include "display_indev.h"
-#include "wasm_app.h"
-#include "wa-inc/timer_wasm_app.h"
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-static void
-hal_init(void);
-// static int tick_thread(void * data);
-// static void memory_monitor(void * param);
-
-/**********************
- * STATIC VARIABLES
- **********************/
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-uint32_t count = 0;
-char count_str[11] = { 0 };
-lv_obj_t *hello_world_label;
-lv_obj_t *count_label;
-lv_obj_t *btn1;
-
-lv_obj_t *label_count1;
-int label_count1_value = 0;
-char label_count1_str[11] = { 0 };
-
-void
-timer1_update(user_timer_t timer1)
-{
- if ((count % 100) == 0) {
- snprintf(count_str, sizeof(count_str), "%d", count / 100);
- lv_label_set_text(count_label, count_str);
- }
- lv_task_handler();
- ++count;
-}
-
-static lv_res_t
-btn_rel_action(lv_obj_t *btn)
-{
- label_count1_value++;
- snprintf(label_count1_str, sizeof(label_count1_str), "%d",
- label_count1_value);
- lv_label_set_text(label_count1, label_count1_str);
- return LV_RES_OK;
-}
-
-void
-on_init()
-{
- /* Initialize LittlevGL */
- lv_init();
-
- /* Initialize the HAL (display, input devices, tick) for LittlevGL */
- hal_init();
-
- hello_world_label = lv_label_create(lv_scr_act(), NULL);
- lv_label_set_text(hello_world_label, "Hello world!");
- lv_obj_align(hello_world_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
-
- count_label = lv_label_create(lv_scr_act(), NULL);
- lv_obj_align(count_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
-
- btn1 = lv_btn_create(
- lv_scr_act(),
- NULL); /* Create a button on the currently loaded screen */
- lv_btn_set_action(btn1, LV_BTN_ACTION_CLICK,
- btn_rel_action); /* Set function to be called when the
- button is released */
- lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0,
- 20); /* Align below the label */
-
- /* Create a label on the button */
- lv_obj_t *btn_label = lv_label_create(btn1, NULL);
- lv_label_set_text(btn_label, "Click ++");
-
- label_count1 = lv_label_create(lv_scr_act(), NULL);
- lv_label_set_text(label_count1, "0");
- lv_obj_align(label_count1, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
-
- /* set up a timer */
- user_timer_t timer;
- timer = api_timer_create(10, true, false, timer1_update);
- if (timer)
- api_timer_restart(timer, 10);
- else
- printf("Fail to create timer.\n");
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-
-/**
- * Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics
- * library
- */
-void
-display_flush_wrapper(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- const lv_color_t *color_p)
-{
- display_flush(x1, y1, x2, y2, color_p);
- lv_flush_ready();
-}
-
-void
-display_vdb_write_wrapper(uint8_t *buf, lv_coord_t buf_w, lv_coord_t x,
- lv_coord_t y, lv_color_t color, lv_opa_t opa)
-{
- display_vdb_write(buf, buf_w, x, y, &color, opa);
-}
-
-void
-display_fill_wrapper(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
- lv_color_t color)
-{
- display_fill(x1, y1, x2, y2, &color);
-}
-
-static void
-hal_init(void)
-{
- /* Add a display */
- lv_disp_drv_t disp_drv;
- lv_disp_drv_init(&disp_drv); /* Basic initialization */
- disp_drv.disp_flush =
- display_flush_wrapper; /* Used when `LV_VDB_SIZE != 0` in lv_conf.h
- (buffered drawing) */
- disp_drv.disp_fill =
- display_fill_wrapper; /* Used when `LV_VDB_SIZE == 0` in lv_conf.h
- (unbuffered drawing) */
- disp_drv.disp_map = display_map; /* Used when `LV_VDB_SIZE == 0` in
- lv_conf.h (unbuffered drawing) */
-#if LV_VDB_SIZE != 0
- disp_drv.vdb_wr = display_vdb_write_wrapper;
-#endif
- lv_disp_drv_register(&disp_drv);
-
- /* Add the mouse as input device
- * Use the 'mouse' driver which reads the PC's mouse */
- // mouse_init();
- lv_indev_drv_t indev_drv;
- lv_indev_drv_init(&indev_drv); /* Basic initialization */
- indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read =
- display_input_read; /* This function will be called periodically (by the
- library) to get the mouse position and state */
- lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv);
-}
-
-/* Implement empry main function as wasi start function calls it */
-int
-main(int argc, char **argv)
-{
- (void)argc;
- (void)argv;
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/system_header.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/system_header.h
deleted file mode 100644
index 59fd59aeb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/littlevgl/wasm-apps/src/system_header.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-
-uint32_t
-time_get_ms(void);
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/CMakeLists.txt
deleted file mode 100644
index 2769b9779..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/CMakeLists.txt
+++ /dev/null
@@ -1,159 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-include(CheckPIESupported)
-
-project(multi_module)
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Resetdefault linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set(WAMR_BUILD_INTERP 1)
-set(WAMR_BUILD_AOT 0)
-set(WAMR_BUILD_JIT 0)
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_LIBC_WASI 1)
-set(WAMR_BUILD_MULTI_MODULE 1)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
- endif ()
-endif ()
-
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib STATIC ${WAMR_RUNTIME_LIB_SOURCE})
-################################################
-
-################ application related ################
-
-################ WASM MODULES
-include(ExternalProject)
-
-message(CHECK_START "Detecting WASI-SDK")
-if(NOT (DEFINED WASI_SDK_DIR OR DEFINED CACHE{WASI_SDK_DIR}))
- find_path(WASI_SDK_PARENT
- wasi-sdk
- PATHS /opt
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
- )
- if(WASI_SDK_PARENT)
- set(WASI_SDK_DIR ${WASI_SDK_PARENT}/wasi-sdk)
- endif()
-endif()
-if(WASI_SDK_DIR)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-message(CHECK_START "Detecting WASI_TOOLCHAIN_FILE at ${WASI_SDK_DIR}")
-find_file(WASI_TOOLCHAIN_FILE
- wasi-sdk.cmake
- PATHS "${WASI_SDK_DIR}/share/cmake"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASI_TOOLCHAIN_FILE)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-message(CHECK_START "Detecting WASI_SYS_ROOT at ${WASI_SDK_DIR}")
-find_path(WASI_SYS_ROOT
- wasi-sysroot
- PATHS "${WASI_SDK_DIR}/share"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASI_SYS_ROOT)
- message(CHECK_PASS "found")
- set(WASI_SYS_ROOT ${WASI_SYS_ROOT}/wasi-sysroot)
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-if((NOT EXISTS ${WASI_SDK_DIR}) OR (NOT EXISTS ${WASI_TOOLCHAIN_FILE}) OR (NOT EXISTS ${WASI_SYS_ROOT}))
- message(FATAL_ERROR "Please set the absolute path of wasi-sdk with \'cmake -DWASI_SDK_DIR=XXX\'")
-else()
- message(STATUS "WASI_SDK_DIR is ${WASI_SDK_DIR}")
- message(STATUS "WASI_TOOLCHAIN_FILE is ${WASI_TOOLCHAIN_FILE}")
- message(STATUS "WASI_SYS_ROOT is ${WASI_SYS_ROOT}")
-endif()
-
-# .c -> .wasm
-ExternalProject_Add(WASM_MODULE
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps
- UPDATE_COMMAND ""
- PATCH_COMMAND ""
- CONFIGURE_COMMAND ${CMAKE_COMMAND}
- -DWASI_SDK_PREFIX=${WASI_SDK_DIR}
- -DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
- -DCMAKE_SYSROOT=${WASI_SYS_ROOT}
- -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps
- BUILD_COMMAND ${CMAKE_COMMAND} --build .
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
- ./mA.wasm ${CMAKE_BINARY_DIR}
- ./mB.wasm ${CMAKE_BINARY_DIR}
- ./mC.wasm ${CMAKE_BINARY_DIR}
- ./mD.wasm ${CMAKE_BINARY_DIR}
- ./mE.wasm ${CMAKE_BINARY_DIR}
-)
-
-################ NATIVE
-include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-add_executable(multi_module src/main.c ${UNCOMMON_SHARED_SOURCE})
-
-add_dependencies(multi_module vmlib WASM_MODULE)
-
-check_pie_supported()
-set_target_properties (multi_module PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-# libraries
-target_link_libraries(multi_module PRIVATE vmlib -lpthread -lm)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/src/main.c
deleted file mode 100644
index ca95ded5f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/src/main.c
+++ /dev/null
@@ -1,167 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "bh_read_file.h"
-#include "platform_common.h"
-#include "wasm_export.h"
-
-static char *
-build_module_path(const char *module_name)
-{
- const char *module_search_path = ".";
- const char *format = "%s/%s.wasm";
- int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
- + strlen(".wasm") + 1;
- char *wasm_file_name = BH_MALLOC(sz);
- if (!wasm_file_name) {
- return NULL;
- }
-
- snprintf(wasm_file_name, sz, format, module_search_path, module_name);
- return wasm_file_name;
-}
-
-static bool
-module_reader_cb(const char *module_name, uint8 **p_buffer, uint32 *p_size)
-{
- char *wasm_file_path = build_module_path(module_name);
- if (!wasm_file_path) {
- return false;
- }
-
- printf("- bh_read_file_to_buffer %s\n", wasm_file_path);
- *p_buffer = (uint8_t *)bh_read_file_to_buffer(wasm_file_path, p_size);
- BH_FREE(wasm_file_path);
- return *p_buffer != NULL;
-}
-
-static void
-module_destroyer_cb(uint8 *buffer, uint32 size)
-{
- printf("- release the read file buffer\n");
- if (!buffer) {
- return;
- }
-
- BH_FREE(buffer);
- buffer = NULL;
-}
-
-/* 10M */
-static char sandbox_memory_space[10 * 1024 * 1024] = { 0 };
-int
-main()
-{
- bool ret = false;
- /* 16K */
- const uint32 stack_size = 16 * 1024;
- const uint32 heap_size = 16 * 1024;
-
- RuntimeInitArgs init_args = { 0 };
- char error_buf[128] = { 0 };
- /* parameters and return values */
- char *args[1] = { 0 };
-
- uint8 *file_buf = NULL;
- uint32 file_buf_size = 0;
- wasm_module_t module = NULL;
- wasm_module_t module1;
- wasm_module_inst_t module_inst = NULL;
-
- /* all malloc() only from the given buffer */
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = sandbox_memory_space;
- init_args.mem_alloc_option.pool.heap_size = sizeof(sandbox_memory_space);
-
- printf("- wasm_runtime_full_init\n");
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- goto EXIT;
- }
-
-#if WASM_ENABLE_MULTI_MODULE != 0
- printf("- wasm_runtime_set_module_reader\n");
- /* set module reader and destroyer */
- wasm_runtime_set_module_reader(module_reader_cb, module_destroyer_cb);
-#endif
-
- /* load WASM byte buffer from WASM bin file */
- if (!module_reader_cb("mC", &file_buf, &file_buf_size)) {
- goto RELEASE_RUNTIME;
- }
-
- /* load mC and let WAMR load mA and mB */
- printf("- wasm_runtime_load\n");
- if (!(module = wasm_runtime_load(file_buf, file_buf_size, error_buf,
- sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto RELEASE_BINARY;
- }
-
- /* instantiate the module */
- printf("- wasm_runtime_instantiate\n");
- if (!(module_inst = wasm_runtime_instantiate(
- module, stack_size, heap_size, error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto UNLOAD_MODULE;
- }
-
- /* call functions of mC */
- printf("\n----------------------------------------\n");
- printf("call \"C1\", it will return 0x1f:i32, ===> ");
- wasm_application_execute_func(module_inst, "C1", 0, args);
- printf("call \"C2\", it will call B1() of mB and return 0x15:i32, ===> ");
- wasm_application_execute_func(module_inst, "C2", 0, args);
- printf("call \"C3\", it will call A1() of mA and return 0xb:i32, ===> ");
- wasm_application_execute_func(module_inst, "C3", 0, args);
- printf("call \"C4\", it will call B2() of mB and call A1() of mA and "
- "return 0xb:i32, ===> ");
- wasm_application_execute_func(module_inst, "C4", 0, args);
- printf(
- "call \"C5\", it will be failed since it is a export function, ===> ");
- wasm_application_execute_func(module_inst, "C5", 0, args);
-
- /* examine module registration a bit */
- module1 = wasm_runtime_find_module_registered("mC");
- if (module1 != NULL) {
- printf("unexpected module mC %p != NULL\n", module1);
- goto UNLOAD_MODULE;
- }
- module1 = wasm_runtime_find_module_registered("mA");
- if (module1 == NULL) {
- printf("unexpected module mA\n");
- goto UNLOAD_MODULE;
- }
- module1 = wasm_runtime_find_module_registered("mB");
- if (module1 == NULL) {
- printf("unexpected module mB\n");
- goto UNLOAD_MODULE;
- }
- if (!wasm_runtime_register_module("mC", module, error_buf,
- sizeof(error_buf))) {
- printf("%s\n", error_buf);
- goto UNLOAD_MODULE;
- }
- module1 = wasm_runtime_find_module_registered("mC");
- if (module1 != module) {
- printf("unexpected module mC %p != %p\n", module1, module);
- goto UNLOAD_MODULE;
- }
-
- ret = true;
-
- printf("- wasm_runtime_deinstantiate\n");
- wasm_runtime_deinstantiate(module_inst);
-UNLOAD_MODULE:
- printf("- wasm_runtime_unload\n");
- wasm_runtime_unload(module);
-RELEASE_BINARY:
- module_destroyer_cb(file_buf, file_buf_size);
-RELEASE_RUNTIME:
- printf("- wasm_runtime_destroy\n");
- wasm_runtime_destroy();
-EXIT:
- return ret ? 0 : 1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/CMakeLists.txt
deleted file mode 100644
index 0dbfcc2e7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/CMakeLists.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 2.8...3.16)
-project(wasm-apps)
-
-message(CHECK_START "Detecting WABT")
-if(NOT (DEFINED WABT_DIR OR DEFINED CACHE{WABT_DIR}))
- find_path(WABT_DIR
- wabt
- PATHS /opt
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
- )
- if(DEFINED WABT_DIR)
- set(WABT_DIR ${WABT_DIR}/wabt)
- endif()
-endif()
-if(WABT_DIR)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-message(CHECK_START "Detecting WASM_OBJDUMP at ${WABT_DIR}")
-find_program(WASM_OBJDUMP
- wasm-objdump
- PATHS "${WABT_DIR}/bin"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASM_OBJDUMP)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-message(CHECK_START "Detecting WASM2WAT at ${WABT_DIR}")
-find_program(WASM2WAT
- wasm2wat
- PATHS "${WABT_DIR}/bin"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASM2WAT)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-function(COMPILE_WITH_CLANG SOURCE_FILE COMMAND)
- get_filename_component(FILE_NAME ${SOURCE_FILE} NAME_WLE)
-
- set(WASM_MODULE ${FILE_NAME}.wasm)
-
- set(MAIN_TARGET_NAME MODULE_${FILE_NAME})
-
- add_executable(${MAIN_TARGET_NAME} ${SOURCE_FILE})
- set_target_properties(${MAIN_TARGET_NAME} PROPERTIES OUTPUT_NAME ${WASM_MODULE})
-
- if(${COMMAND})
- message(STATUS "Generating ${WASM_MODULE} as COMMAND...")
- else()
- message(STATUS "Generating ${WASM_MODULE} as REACTOR...")
- target_link_options(${MAIN_TARGET_NAME} PRIVATE -mexec-model=reactor)
- endif()
-
- if(EXISTS ${WASM2WAT})
- message(STATUS "Dumping ${WASM_MODULE}...")
- set(WASM_WAT ${FILE_NAME}.wat)
- set(DUMP_TARGET_NAME DUMP_${FILE_NAME})
- add_custom_command(OUTPUT ${WASM_WAT}
- COMMAND ${WASM2WAT} --enable-all -o ${WASM_WAT} ${WASM_MODULE}
- COMMENT "Dumping ${WASM_MODULE}..."
- DEPENDS ${MAIN_TARGET_NAME}
- )
-
- add_custom_target(${DUMP_TARGET_NAME} ALL
- DEPENDS ${WASM_WAT}
- )
- endif()
-endfunction()
-
-compile_with_clang(mA.c OFF)
-compile_with_clang(mB.c OFF)
-compile_with_clang(mC.c ON)
-compile_with_clang(mD.cpp ON)
-compile_with_clang(mE.cpp OFF)
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mA.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mA.c
deleted file mode 100644
index 663ec8169..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mA.c
+++ /dev/null
@@ -1,13 +0,0 @@
-__attribute__((export_name("A1"))) int
-A1()
-{
- return 11;
-}
-
-int
-A2()
-{
- return 12;
-}
-
-/* mA is a reactor. it doesn't need a main() */ \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mB.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mB.c
deleted file mode 100644
index a912d1d77..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mB.c
+++ /dev/null
@@ -1,23 +0,0 @@
-__attribute__((import_module("mA")))
-__attribute__((import_name("A1"))) extern int
-A1();
-
-__attribute__((export_name("B1"))) int
-B1()
-{
- return 21;
-}
-
-__attribute__((export_name("B2"))) int
-B2()
-{
- return A1();
-}
-
-int
-B3()
-{
- return 23;
-}
-
-/* mA is a reactor. it doesn't need a main() */ \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mC.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mC.c
deleted file mode 100644
index 8b19a5b66..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mC.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-__attribute__((import_module("mA")))
-__attribute__((import_name("A1"))) extern int
-A1();
-
-__attribute__((import_module("mB")))
-__attribute__((import_name("B1"))) extern int
-B1();
-
-__attribute__((import_module("mB")))
-__attribute__((import_name("B2"))) extern int
-B2();
-
-__attribute__((export_name("C1"))) int
-C1()
-{
- return 31;
-}
-
-__attribute__((export_name("C2"))) int
-C2()
-{
- return B1();
-}
-
-__attribute__((export_name("C3"))) int
-C3()
-{
- return A1();
-}
-
-__attribute__((export_name("C4"))) int
-C4()
-{
- return B2();
-}
-
-int
-C5()
-{
- return C1() + C2() + C3() + 35;
-}
-
-int
-main()
-{
- printf("%u\n", C5());
- return EXIT_SUCCESS;
-} \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mD.cpp b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mD.cpp
deleted file mode 100644
index d70998c08..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mD.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <cstdlib>
-#include <cstdio>
-#include <iostream>
-
-static void
-bye_main()
-{
- std::cout << "mD " << __FUNCTION__ << std::endl;
-}
-
-static void
-bye_setup()
-{
- std::cout << "mD " << __FUNCTION__ << std::endl;
-}
-
-static void
-bye_func()
-{
- std::cout << "mD " << __FUNCTION__ << std::endl;
-}
-
-void
-func3() __attribute__((__import_module__("mE"), __import_name__("func1")));
-
-void
-func4() __attribute__((__import_module__("mE"), __import_name__("func2")));
-
-void
-func1()
-{
- std::printf("mD %s\n", __FUNCTION__);
- if (std::atexit(bye_func) != 0) {
- std::perror("register an atexit handler failed");
- }
- func3();
-}
-
-void
-func2()
-{
- std::printf("mD %s\n", __FUNCTION__);
- func4();
-}
-
-__attribute__((constructor)) void
-setup()
-{
- std::cout << "mD " << __FUNCTION__ << std::endl;
- if (std::atexit(bye_setup) != 0) {
- std::perror("register an atexit handler failed");
- }
-}
-
-__attribute__((destructor)) void
-teardown()
-{
- std::cout << "mD " << __FUNCTION__ << std::endl;
-}
-
-int
-main()
-{
- std::printf("mD %s\n", __FUNCTION__);
-
- if (std::atexit(bye_main) != 0) {
- std::perror("register an atexit handler failed");
- return EXIT_FAILURE;
- }
-
- func1();
- func2();
- return EXIT_SUCCESS;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp
deleted file mode 100644
index 11e70af1f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-module/wasm-apps/mE.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <cstdlib>
-#include <cstdio>
-#include <iostream>
-
-static void
-bye_setup()
-{
- std::cout << "mE " << __FUNCTION__ << std::endl;
-}
-
-static void
-bye_func()
-{
- std::cout << "mE " << __FUNCTION__ << std::endl;
-}
-
-__attribute__((constructor)) void
-setup()
-{
- std::cout << "mE " << __FUNCTION__ << std::endl;
- if (std::atexit(bye_setup) != 0) {
- std::perror("register an atexit handler failed");
- }
-}
-
-__attribute__((destructor)) void
-teardown()
-{
- std::cout << "mE " << __FUNCTION__ << std::endl;
-}
-
-__attribute__((export_name("func1"))) void
-func1()
-{
- std::cout << "mE " << __FUNCTION__ << std::endl;
- if (std::atexit(bye_func) != 0) {
- std::perror("register an atexit handler failed");
- }
-}
-
-__attribute__((export_name("func2"))) void
-func2()
-{
- std::cout << "mE " << __FUNCTION__ << std::endl;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/CMakeLists.txt
deleted file mode 100644
index 67819eca2..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-
-include(CheckPIESupported)
-
-project(pthread)
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Resetdefault linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set(WAMR_BUILD_INTERP 1)
-set(WAMR_BUILD_AOT 1)
-set(WAMR_BUILD_JIT 0)
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_FAST_INTERP 1)
-set(WAMR_BUILD_LIB_PTHREAD 1)
-set(WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 1)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-################################################
-
-
-################ wasm application ################
-add_subdirectory(wasm-apps)
-
-################ wamr runtime ################
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-set (RUNTIME_SOURCE_ALL
- ${CMAKE_CURRENT_LIST_DIR}/../../product-mini/platforms/linux/main.c
- ${UNCOMMON_SHARED_SOURCE}
-)
-add_executable (iwasm ${RUNTIME_SOURCE_ALL})
-check_pie_supported()
-set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_link_libraries(iwasm vmlib -lpthread -lm -ldl)
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/CMakeLists.txt
deleted file mode 100644
index d7352e427..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 2.8)
-project(wasm-apps)
-
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
-
-if (APPLE)
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
- set (CMAKE_C_LINK_FLAGS "")
- set (CMAKE_CXX_LINK_FLAGS "")
-endif ()
-set(CMAKE_SYSTEM_PROCESSOR wasm32)
-set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
-
-if (NOT DEFINED WASI_SDK_DIR)
- set (WASI_SDK_DIR "/opt/wasi-sdk")
-endif ()
-
-set (CMAKE_C_FLAGS "-nostdlib -pthread -Qunused-arguments")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -z stack-size=32768")
-set (CMAKE_C_COMPILER_TARGET "wasm32")
-set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
-
-set (DEFINED_SYMBOLS
-"${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt")
-
-set (CMAKE_EXE_LINKER_FLAGS
- "-Wl,--shared-memory,--max-memory=131072, \
- -Wl,--no-entry,--strip-all, \
- -Wl,--export=__heap_base,--export=__data_end \
- -Wl,--export=__wasm_call_ctors \
- -Wl,--export=main -Wl,--export=__main_argc_argv \
- -Wl,--allow-undefined"
- #-Wl,--allow-undefined-file=${DEFINED_SYMBOLS}"
-)
-
-add_executable(test.wasm main.c)
-target_link_libraries(test.wasm)
-
-add_executable(main_thread_exception.wasm main_thread_exception.c)
-target_link_libraries(main_thread_exception.wasm)
-
-add_executable(main_global_atomic.wasm main_global_atomic.c)
-target_link_libraries(main_global_atomic.wasm) \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main.c
deleted file mode 100644
index 2b9581f1c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <pthread.h>
-#include <semaphore.h>
-
-static pthread_mutex_t mutex;
-static pthread_cond_t cond;
-static sem_t *sem;
-
-static void *
-thread(void *arg)
-{
- int *num = (int *)arg;
-
- pthread_mutex_lock(&mutex);
- printf("thread start \n");
-
- for (int i = 0; i < 10; i++) {
- *num = *num + 1;
- printf("num: %d\n", *num);
- }
-
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
- sem_post(sem);
-
- printf("thread exit \n");
-
- return NULL;
-}
-
-int
-main(int argc, char *argv[])
-{
- pthread_t tid;
- int num = 0, ret = -1;
-
- if (pthread_mutex_init(&mutex, NULL) != 0) {
- printf("Failed to init mutex.\n");
- return -1;
- }
- if (pthread_cond_init(&cond, NULL) != 0) {
- printf("Failed to init cond.\n");
- goto fail1;
- }
-
- // O_CREAT and S_IRGRPS_IRGRP | S_IWGRP on linux (glibc), initial value is 0
-
- if (!(sem = sem_open("tessstsem", 0100, 0x10 | 0x20, 0))) {
- printf("Failed to open sem. %p\n", sem);
- goto fail2;
- }
-
- pthread_mutex_lock(&mutex);
- if (pthread_create(&tid, NULL, thread, &num) != 0) {
- printf("Failed to create thread.\n");
- pthread_mutex_unlock(&mutex);
- goto fail3;
- }
-
- printf("cond wait start\n");
- pthread_cond_wait(&cond, &mutex);
- pthread_mutex_unlock(&mutex);
- printf("cond wait success.\n");
-
- if (sem_wait(sem) != 0) {
- printf("Failed to wait sem.\n");
- }
- else {
- printf("sem wait success.\n");
- }
-
- if (pthread_join(tid, NULL) != 0) {
- printf("Failed to join thread.\n");
- }
-
- ret = 0;
-
-fail3:
- sem_close(sem);
- sem_unlink("tessstsem");
-fail2:
- pthread_cond_destroy(&cond);
-fail1:
- pthread_mutex_destroy(&mutex);
-
- return ret;
-} \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_global_atomic.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_global_atomic.c
deleted file mode 100644
index dafbea886..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_global_atomic.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <pthread.h>
-
-#define MAX_NUM_THREADS 4
-#define NUM_ITER 1000
-
-int g_count = 0;
-
-static void *
-thread(void *arg)
-{
- for (int i = 0; i < NUM_ITER; i++) {
- __atomic_fetch_add(&g_count, 1, __ATOMIC_SEQ_CST);
- }
-
- return NULL;
-}
-
-int
-main(int argc, char **argv)
-{
- pthread_t tids[MAX_NUM_THREADS];
-
- for (int i = 0; i < MAX_NUM_THREADS; i++) {
- if (pthread_create(&tids[i], NULL, thread, NULL) != 0) {
- printf("Thread creation failed\n");
- }
- }
-
- for (int i = 0; i < MAX_NUM_THREADS; i++) {
- if (pthread_join(tids[i], NULL) != 0) {
- printf("Thread join failed\n");
- }
- }
-
- printf("Value of counter after update: %d (expected=%d)\n", g_count,
- MAX_NUM_THREADS * NUM_ITER);
- if (g_count != MAX_NUM_THREADS * NUM_ITER) {
- __builtin_trap();
- }
-
- return -1;
-} \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_thread_exception.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_thread_exception.c
deleted file mode 100644
index 80f170d40..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/multi-thread/wasm-apps/main_thread_exception.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <pthread.h>
-
-typedef struct ThreadArgs {
- int start;
- int length;
-} ThreadArgs;
-
-void *
-thread(void *args)
-{
- while (1) {
- /* When other threads (including main thread) throw exception,
- this thread can successfully exit the dead loop */
- }
-}
-
-int
-main()
-{
- pthread_t tids;
-
- if (pthread_create(&tids, NULL, thread, NULL) != 0) {
- printf("pthread_create failed\n");
- }
-
- /* Trigger an exception */
- __builtin_trap();
-
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/CMakeLists.txt
deleted file mode 100644
index d8201bae4..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-
-include(CheckPIESupported)
-
-project(native_lib)
-
-################ runtime settings ##############
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported are:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_FAST_INTERP 1)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-
-# build out libiwasm
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-# Note: we build libiwasm as a shared library here so that it can be
-# shared between iwasm and native libraries.
-add_library(libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})
-set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)
-
-################ wamr runtime ###################
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-set (RUNTIME_SOURCE_ALL
- ${WAMR_ROOT_DIR}/product-mini/platforms/posix/main.c
- ${UNCOMMON_SHARED_SOURCE}
-)
-
-add_executable (iwasm ${RUNTIME_SOURCE_ALL})
-
-check_pie_supported()
-set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-target_link_libraries(iwasm libiwasm -lpthread -lm -ldl)
-
-################ native libraries ###############
-add_library (test_add SHARED test_add.c)
-add_library (test_sqrt SHARED test_sqrt.c)
-add_library (test_hello SHARED test_hello.c)
-# Note: Unlike simpler examples above, test_hello2 directly uses
-# the API provided by the libiwasm library.
-add_library (test_hello2 SHARED test_hello2.c)
-target_link_libraries(test_hello2 libiwasm)
-
-################ wasm application ###############
-add_subdirectory(wasm-app)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/README.md
deleted file mode 100644
index 2bf65814d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# "native-lib" sample introduction
-
-This sample demonstrates how to write required interfaces in native library, build it into a shared library and register the shared library to iwasm.
-
-The native library should provide `get_native_lib` API for iwasm to return the native library info, including the module name, the native symbol list and the native symbol count, so that iwasm can use them to regiter the native library, for example:
-
-```C
-static int
-foo_wrapper(wasm_exec_env_t exec_env, int x, int y)
-{
- return x + y;
-}
-
-#define REG_NATIVE_FUNC(func_name, signature) \
- { #func_name, func_name##_wrapper, signature, NULL }
-
-static NativeSymbol native_symbols[] = {
- REG_NATIVE_FUNC(foo, "(ii)i")
-};
-
-uint32_t
-get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols)
-{
- *p_module_name = "env";
- *p_native_symbols = native_symbols;
- return sizeof(native_symbols) / sizeof(NativeSymbol);
-}
-```
-
-## Preparation
-
-Please install WASI SDK, download the [wasi-sdk release](https://github.com/CraneStation/wasi-sdk/releases) and extract the archive to default path `/opt/wasi-sdk`.
-
-## Build the sample
-
-```bash
-mkdir build
-cd build
-cmake ..
-make
-```
-
-`iwasm`, one wasm module `test.wasm` and two shared libraries `libtest_add.so`, `libtest_sqrt.so`
-will be generated.
-
-## Run workload
-
-### Linux
-
-```bash
-cd build
-./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so --native-lib=./libtest_hello2.so wasm-app/test.wasm
-```
-
-### macOS
-
-```bash
-cd build
-./iwasm --native-lib=libtest_add.dylib --native-lib=libtest_sqrt.dylib --native-lib=libtest_hello.dylib --native-lib=libtest_hello2.dylib wasm-app/test.wasm
-```
-
-The output is:
-
-```bash
-Hello World!
-10 + 20 = 30
-sqrt(10, 20) = 500
-test_hello("main", 0x0, 0) = 41
-malloc(42) = 0x24e8
-test_hello("main", 0x24e8, 42) = 41
-Message from test_hello: Hello, main. This is test_hello_wrapper!
-test_hello2("main", 0x0, 0) = 85
-malloc(86) = 0x24e8
-test_hello2("main", 0x24e8, 86) = 85
-Message from test_hello2: Hello, main. This is test_hello2_wrapper! Your wasm_module_inst_t is 0x7fd443704990.
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_add.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_add.c
deleted file mode 100644
index ac44c6192..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_add.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "wasm_export.h"
-
-static int
-test_add_wrapper(wasm_exec_env_t exec_env, int x, int y)
-{
- return x + y;
-}
-
-/* clang-format off */
-#define REG_NATIVE_FUNC(func_name, signature) \
- { #func_name, func_name##_wrapper, signature, NULL }
-
-static NativeSymbol native_symbols[] = {
- REG_NATIVE_FUNC(test_add, "(ii)i")
-};
-/* clang-format on */
-
-uint32_t
-get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols)
-{
- *p_module_name = "env";
- *p_native_symbols = native_symbols;
- return sizeof(native_symbols) / sizeof(NativeSymbol);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello.c
deleted file mode 100644
index c322ec24e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "wasm_export.h"
-
-static int
-test_hello_wrapper(wasm_exec_env_t exec_env, const char *name, char *result,
- size_t resultlen)
-{
- return snprintf(result, resultlen, "Hello, %s. This is %s!\n", name,
- __func__);
-}
-
-/* clang-format off */
-#define REG_NATIVE_FUNC(func_name, signature) \
- { #func_name, func_name##_wrapper, signature, NULL }
-
-static NativeSymbol native_symbols[] = {
- REG_NATIVE_FUNC(test_hello, "($*~)i")
-};
-/* clang-format on */
-
-uint32_t
-get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols)
-{
- *p_module_name = "env";
- *p_native_symbols = native_symbols;
- return sizeof(native_symbols) / sizeof(NativeSymbol);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello2.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello2.c
deleted file mode 100644
index 2c8f69ed6..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_hello2.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-/*
- * This example basically does the same thing as test_hello.c,
- * using wasm_export.h API.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "wasm_export.h"
-
-static int
-test_hello2_wrapper(wasm_exec_env_t exec_env, uint32_t nameaddr,
- uint32_t resultaddr, uint32_t resultlen)
-{
- /*
- * Perform wasm_runtime_malloc to check if the runtime has been
- * initialized as expected.
- * This would fail with "memory hasn't been initialize" error
- * unless we are not sharing a runtime with the loader app. (iwasm)
- */
- void *p = wasm_runtime_malloc(1);
- if (p == NULL) {
- return -1;
- }
- wasm_runtime_free(p);
-
- wasm_module_inst_t inst = wasm_runtime_get_module_inst(exec_env);
- if (!wasm_runtime_validate_app_str_addr(inst, nameaddr)
- || !wasm_runtime_validate_app_addr(inst, resultaddr, resultlen)) {
- return -1;
- }
- const char *name = wasm_runtime_addr_app_to_native(inst, nameaddr);
- char *result = wasm_runtime_addr_app_to_native(inst, resultaddr);
- return snprintf(result, resultlen,
- "Hello, %s. This is %s! Your wasm_module_inst_t is %p.\n",
- name, __func__, inst);
-}
-
-/* clang-format off */
-#define REG_NATIVE_FUNC(func_name, signature) \
- { #func_name, func_name##_wrapper, signature, NULL }
-
-static NativeSymbol native_symbols[] = {
- REG_NATIVE_FUNC(test_hello2, "(iii)i")
-};
-/* clang-format on */
-
-uint32_t
-get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols)
-{
- *p_module_name = "env";
- *p_native_symbols = native_symbols;
- return sizeof(native_symbols) / sizeof(NativeSymbol);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_sqrt.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_sqrt.c
deleted file mode 100644
index ecf7c989c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/test_sqrt.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "wasm_export.h"
-
-static int
-test_sqrt_wrapper(wasm_exec_env_t exec_env, int x, int y)
-{
- return x * x + y * y;
-}
-
-/* clang-format off */
-#define REG_NATIVE_FUNC(func_name, signature) \
- { #func_name, func_name##_wrapper, signature, NULL }
-
-static NativeSymbol native_symbols[] = {
- REG_NATIVE_FUNC(test_sqrt, "(ii)i")
-};
-/* clang-format on */
-
-uint32_t
-get_native_lib(char **p_module_name, NativeSymbol **p_native_symbols)
-{
- *p_module_name = "env";
- *p_native_symbols = native_symbols;
- return sizeof(native_symbols) / sizeof(NativeSymbol);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/CMakeLists.txt
deleted file mode 100644
index ffcd9005a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.0)
-project(wasm-app)
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
-
-if (APPLE)
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
- set (CMAKE_C_LINK_FLAGS "")
- set (CMAKE_CXX_LINK_FLAGS "")
-endif ()
-
-set (CMAKE_SYSTEM_PROCESSOR wasm32)
-set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
-
-if (NOT DEFINED WASI_SDK_DIR)
- set (WASI_SDK_DIR "/opt/wasi-sdk")
-endif ()
-
-set (CMAKE_C_FLAGS "-nostdlib")
-set (CMAKE_C_COMPILER_TARGET "wasm32")
-set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
-
-set (CMAKE_EXE_LINKER_FLAGS
- "-Wl,--max-memory=131072 -z stack-size=8192 \
- -Wl,--no-entry,--strip-all \
- -Wl,--export=__main_argc_argv \
- -Wl,--export=__heap_base,--export=__data_end \
- -Wl,--allow-undefined"
-)
-
-add_executable(test.wasm main.c)
-target_link_libraries(test.wasm)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/main.c
deleted file mode 100644
index dba652daf..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/native-lib/wasm-app/main.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-test_add(int x, int y);
-
-int
-test_sqrt(int x, int y);
-
-int
-test_hello(const char *name, char *buf, size_t buflen);
-
-int
-test_hello2(const char *name, char *buf, size_t buflen);
-
-int
-main(int argc, char **argv)
-{
- const char *name = __func__;
- char *buf;
- size_t buflen;
- int x = 10, y = 20, res;
-
- printf("Hello World!\n");
-
- res = test_add(x, y);
- printf("%d + %d = %d\n", x, y, res);
-
- res = test_sqrt(x, y);
- printf("sqrt(%d, %d) = %d\n", x, y, res);
-
- res = test_hello(name, NULL, 0);
- printf("test_hello(\"%s\", %p, %zu) = %d\n", name, NULL, (size_t)0, res);
- if (res == -1) {
- return -1;
- }
- buflen = res + 1;
- buf = malloc(buflen);
- printf("malloc(%zu) = %p\n", buflen, buf);
- res = test_hello(__func__, buf, buflen);
- if (res == -1) {
- return -1;
- }
- printf("test_hello(\"%s\", %p, %zu) = %d\n", name, buf, buflen, res);
- printf("Message from test_hello: %s", buf);
- free(buf);
-
- res = test_hello2(name, NULL, 0);
- printf("test_hello2(\"%s\", %p, %zu) = %d\n", name, NULL, (size_t)0, res);
- if (res == -1) {
- return -1;
- }
- buflen = res + 1;
- buf = malloc(buflen);
- printf("malloc(%zu) = %p\n", buflen, buf);
- res = test_hello2(__func__, buf, buflen);
- if (res == -1) {
- return -1;
- }
- printf("test_hello2(\"%s\", %p, %zu) = %d\n", name, buf, buflen, res);
- printf("Message from test_hello2: %s", buf);
- free(buf);
-
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/CMakeLists.txt
deleted file mode 100644
index 325699b20..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/CMakeLists.txt
+++ /dev/null
@@ -1,139 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-include(CheckPIESupported)
-
-if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
- project(ref-types)
-else()
- project (ref-types C ASM)
- enable_language (ASM_MASM)
-endif()
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Resetdefault linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-if(NOT DEFINED WAMR_BUILD_INTERP)
- set(WAMR_BUILD_INTERP 1)
-endif()
-
-if(NOT DEFINED WAMR_BUILD_AOT)
- set(WAMR_BUILD_AOT 0)
-endif()
-
-if(NOT DEFINED WAMR_BUILD_JOT)
- set(WAMR_BUILD_JIT 0)
-endif()
-
-if(NOT DEFINED WAMR_BUILD_FAST_INTERP)
- set(WAMR_BUILD_FAST_INTERP 1)
-endif()
-
-if(NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
- set(WAMR_BUILD_LIBC_BUILTIN 1)
-endif()
-
-# Enable reference-types feature
-set(WAMR_BUILD_REF_TYPES 1)
-
-if (NOT MSVC)
- # compiling and linking flags
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
- endif ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
- if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
- endif ()
- endif ()
-endif()
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-set(WAMRC ${WAMR_ROOT_DIR}/wamr-compiler/build/wamrc)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib STATIC ${WAMR_RUNTIME_LIB_SOURCE})
-if (MSVC)
- target_compile_definitions(vmlib PRIVATE WASM_API_EXTERN=)
-endif()
-
-################ application related ################
-## locate wat2wasm
-find_program(WAT2WASM
- wat2wasm
- PATHS /opt/wabt/bin
- REQUIRED
-)
-
-if(NOT WAT2WASM)
- message(SEND_ERROR "can not find wat2wasm")
-else ()
- execute_process(COMMAND ${WAT2WASM} --version
- OUTPUT_VARIABLE WAT2WASM_VERSION_OUTPUT)
- string(STRIP ${WAT2WASM_VERSION_OUTPUT} WAT2WASM_VERSION)
- message("-- Found wat2wasm ${WAT2WASM_VERSION}")
-endif()
-
-if (${WAT2WASM_VERSION} VERSION_LESS 1.0.26)
- set(WAT2WASM_FLAGS "--enable-reference-types")
-endif ()
-
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-add_executable(hello src/hello.c ${UNCOMMON_SHARED_SOURCE})
-
-check_pie_supported()
-set_target_properties (hello PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-target_include_directories(hello PRIVATE ${UNCOMMON_SHARED_DIR})
-
-target_link_libraries(hello vmlib -lpthread -lm)
-
-if (MSVC)
- target_compile_definitions(hello PRIVATE WASM_API_EXTERN=)
-endif()
-
-# wat to wasm
-file(GLOB WAT_FILE src/hello.wat)
-add_custom_target(hello_wasm ALL
- COMMAND ${WAT2WASM} ${WAT_FILE} ${WAT2WASM_FLAGS} -o ${PROJECT_BINARY_DIR}/hello.wasm
- DEPENDS ${WAT_FILE}
- BYPRODUCTS ${PROJECT_BINARY_DIR}/hello.wasm
- VERBATIM
- SOURCES ${WAT_FILE}
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.c
deleted file mode 100644
index db2f7997f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "bh_platform.h"
-#include "bh_read_file.h"
-#include "wasm_export.h"
-
-#define USE_GLOBAL_HEAP_BUF 0
-
-#if USE_GLOBAL_HEAP_BUF != 0
-static char global_heap_buf[10 * 1024 * 1024] = { 0 };
-#endif
-
-static uintptr_t global_objects[10] = { 0 };
-
-int32
-local_cmp_externref(wasm_exec_env_t exec_env, uintptr_t externref_a,
- uintptr_t externref_b)
-{
- return externref_a == externref_b;
-}
-
-int32
-local_chk_externref(wasm_exec_env_t exec_env, int32 index, uintptr_t externref)
-{
- return externref == global_objects[index];
-}
-
-/* clang-format off */
-static NativeSymbol native_symbols[] = {
- { "native-cmp-externref", local_cmp_externref, "(rr)i", NULL },
- { "native-chk-externref", local_chk_externref, "(ir)i", NULL },
-};
-/* clang-format on */
-
-static inline void
-local_set_externref(int32 index, uintptr_t externref)
-{
- global_objects[index] = externref;
-}
-
-static WASMFunctionInstanceCommon *wasm_set_externref_ptr;
-static WASMFunctionInstanceCommon *wasm_get_externref_ptr;
-static WASMFunctionInstanceCommon *wasm_cmp_externref_ptr;
-
-static bool
-wasm_set_externref(wasm_exec_env_t exec_env, wasm_module_inst_t inst,
- int32 index, uintptr_t externref)
-{
- union {
- uintptr_t val;
- uint32 parts[2];
- } u;
- uint32 argv[3] = { 0 };
-
- if (!exec_env || !wasm_set_externref_ptr) {
- return false;
- }
-
- u.val = externref;
- argv[0] = index;
- argv[1] = u.parts[0];
- argv[2] = u.parts[1];
- if (!wasm_runtime_call_wasm(exec_env, wasm_set_externref_ptr, 2, argv)) {
- const char *exception;
- if ((exception = wasm_runtime_get_exception(inst))) {
- printf("Exception: %s\n", exception);
- }
- return false;
- }
-
- return true;
-}
-
-static bool
-wasm_get_externref(wasm_exec_env_t exec_env, wasm_module_inst_t inst,
- int32 index, uintptr_t *ret_externref)
-{
- wasm_val_t results[1] = { 0 };
-
- if (!exec_env || !wasm_get_externref_ptr || !ret_externref) {
- return false;
- }
-
- if (!wasm_runtime_call_wasm_v(exec_env, wasm_get_externref_ptr, 1, results,
- 1, index)) {
- const char *exception;
- if ((exception = wasm_runtime_get_exception(inst))) {
- printf("Exception: %s\n", exception);
- }
- return false;
- }
-
- if (WASM_ANYREF != results[0].kind) {
- return false;
- }
-
- *ret_externref = results[0].of.foreign;
- return true;
-}
-
-static bool
-wasm_cmp_externref(wasm_exec_env_t exec_env, wasm_module_inst_t inst,
- int32 index, uintptr_t externref, int32 *ret_result)
-{
- wasm_val_t results[1] = { 0 };
- wasm_val_t arguments[2] = {
- { .kind = WASM_I32, .of.i32 = index },
- { .kind = WASM_ANYREF, .of.foreign = externref },
- };
-
- if (!exec_env || !wasm_cmp_externref_ptr || !ret_result) {
- return false;
- }
-
- if (!wasm_runtime_call_wasm_a(exec_env, wasm_cmp_externref_ptr, 1, results,
- 2, arguments)) {
- const char *exception;
- if ((exception = wasm_runtime_get_exception(inst))) {
- printf("Exception: %s\n", exception);
- }
- return false;
- }
-
- if (results[0].kind != WASM_I32) {
- return false;
- }
-
- *ret_result = results[0].of.i32;
- return true;
-}
-
-static bool
-set_and_cmp(wasm_exec_env_t exec_env, wasm_module_inst_t inst, int32 i,
- uintptr_t externref)
-{
- int32 cmp_result = 0;
- uintptr_t wasm_externref = 0;
-
- wasm_set_externref(exec_env, inst, i, externref);
- local_set_externref(i, externref);
-
- wasm_get_externref(exec_env, inst, 0, &wasm_externref);
- if (!local_chk_externref(exec_env, 0, wasm_externref)) {
- printf("#%d, In host language world Wasm Externref 0x%lx Vs. Native "
- "Externref 0x%lx FAILED\n",
- i, wasm_externref, externref);
- return false;
- }
-
- if (!wasm_cmp_externref(exec_env, inst, i, global_objects[i], &cmp_result)
- || !cmp_result) {
- printf("#%d, In Wasm world Native Externref 0x%lx Vs, Wasm Externref "
- "FAILED\n",
- i, global_objects[i]);
- return false;
- }
-
- return true;
-}
-
-int
-main(int argc, char *argv[])
-{
- char *wasm_file = "hello.wasm";
- uint8 *wasm_file_buf = NULL;
- uint32 wasm_file_size;
- uint32 stack_size = 16 * 1024, heap_size = 16 * 1024;
- wasm_module_t wasm_module = NULL;
- wasm_module_inst_t wasm_module_inst = NULL;
- wasm_exec_env_t exec_env = NULL;
- RuntimeInitArgs init_args;
- char error_buf[128] = { 0 };
-#if WASM_ENABLE_LOG != 0
- int log_verbose_level = 2;
-#endif
- const uint64 big_number = 0x123456789abc;
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
-#if USE_GLOBAL_HEAP_BUF != 0
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-#else
- init_args.mem_alloc_type = Alloc_With_Allocator;
- init_args.mem_alloc_option.allocator.malloc_func = malloc;
- init_args.mem_alloc_option.allocator.realloc_func = realloc;
- init_args.mem_alloc_option.allocator.free_func = free;
-#endif
-
- init_args.n_native_symbols = sizeof(native_symbols) / sizeof(NativeSymbol);
- init_args.native_module_name = "env";
- init_args.native_symbols = native_symbols;
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
-#if WASM_ENABLE_LOG != 0
- bh_log_set_verbose_level(log_verbose_level);
-#endif
-
- /* load WASM byte buffer from WASM bin file */
- if (!(wasm_file_buf =
- (uint8 *)bh_read_file_to_buffer(wasm_file, &wasm_file_size)))
- goto fail;
-
- /* load WASM module */
- if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size,
- error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto fail;
- }
-
- /* instantiate the module */
- if (!(wasm_module_inst =
- wasm_runtime_instantiate(wasm_module, stack_size, heap_size,
- error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto fail;
- }
-
- /* create an execution env */
- if (!(exec_env =
- wasm_runtime_create_exec_env(wasm_module_inst, stack_size))) {
- printf("%s\n", "create exec env failed");
- goto fail;
- }
-
- /* lookup function instance */
- if (!(wasm_cmp_externref_ptr = wasm_runtime_lookup_function(
- wasm_module_inst, "cmp-externref", NULL))) {
- printf("%s\n", "lookup function cmp-externref failed");
- goto fail;
- }
-
- if (!(wasm_get_externref_ptr = wasm_runtime_lookup_function(
- wasm_module_inst, "get-externref", NULL))) {
- printf("%s\n", "lookup function get-externref failed");
- goto fail;
- }
-
- if (!(wasm_set_externref_ptr = wasm_runtime_lookup_function(
- wasm_module_inst, "set-externref", NULL))) {
- printf("%s\n", "lookup function set-externref failed");
- goto fail;
- }
-
- /* test with NULL */
- if (!set_and_cmp(exec_env, wasm_module_inst, 0, 0)
- || !set_and_cmp(exec_env, wasm_module_inst, 1, big_number + 1)
- || !set_and_cmp(exec_env, wasm_module_inst, 2, big_number + 2)
- || !set_and_cmp(exec_env, wasm_module_inst, 3, big_number + 3)) {
- goto fail;
- }
-
- printf("GREAT! PASS ALL CHKs\n");
-
-fail:
- /* destroy exec env */
- if (exec_env) {
- wasm_runtime_destroy_exec_env(exec_env);
- }
-
- /* destroy the module instance */
- if (wasm_module_inst) {
- wasm_runtime_deinstantiate(wasm_module_inst);
- }
-
- /* unload the module */
- if (wasm_module) {
- wasm_runtime_unload(wasm_module);
- }
-
- /* free the file buffer */
- if (wasm_file_buf) {
- wasm_runtime_free(wasm_file_buf);
- }
-
- /* destroy runtime environment */
- wasm_runtime_destroy();
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.wat
deleted file mode 100644
index 3c2d2f96d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/ref-types/src/hello.wat
+++ /dev/null
@@ -1,44 +0,0 @@
-;; Copyright (C) 2019 Intel Corporation. All rights reserved.
-;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-(module
- (type $t0 (func (param i32 externref) (result i32)))
-
- (import "env" "native-cmp-externref"
- (func $native-cmp-externref (param externref externref) (result i32))
- )
-
- (import "env" "native-chk-externref"
- (func $native-chk-externref (param i32 externref) (result i32))
- )
-
- (table $t1 8 8 externref)
- (table $t2 funcref
- (elem
- $native-cmp-externref
- $native-chk-externref
- )
- )
-
- (func (export "set-externref") (param $i i32) (param $r externref)
- (table.set $t1 (local.get $i) (local.get $r))
- )
-
- (func (export "get-externref") (param $i i32) (result externref)
- (table.get $t1 (local.get $i))
- )
-
- (func (export "cmp-externref") (param $i i32) (param $r externref) (result i32)
- (table.get $t1 (local.get $i))
- (local.get $r)
- (call $native-cmp-externref)
- )
-
- (func (export "chk-externref") (param $i i32) (param $r externref) (result i32)
- (call_indirect $t2 (type $t0)
- (local.get $i)
- (local.get $r)
- (i32.const 1)
- )
- )
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/CMakeLists.txt
deleted file mode 100644
index 7ab552248..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/CMakeLists.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright (c) 2022 Intel Corporation
-# Copyright (c) 2020-2021 Alibaba Cloud
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.1.4)
-project(sgx-ra)
-
-################ runtime settings ##############
-set (WAMR_BUILD_PLATFORM "linux-sgx")
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# Set WAMR_BUILD_TARGET
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 1)
-set (WAMR_BUILD_LIB_PTHREAD 1)
-set (WAMR_BUILD_FAST_INTERP 1)
-set (WAMR_BUILD_LIB_RATS 1)
-
-# compiling and linking flags
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -ffunction-sections -fdata-sections \
- -Wall -Wno-unused-parameter -Wno-pedantic \
- -nostdinc -fvisibility=hidden -fpie" )
-
-# build out vmlib
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-set (SGX_PLATFORM_DIR ${WAMR_ROOT_DIR}/product-mini/platforms/linux-sgx)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-
-add_custom_command (
- OUTPUT libvmlib_untrusted.a
- COMMAND mkdir -p untrusted && cd untrusted &&
- ${CMAKE_C_COMPILER} -c ${PLATFORM_SHARED_SOURCE_UNTRUSTED}
- COMMAND ${CMAKE_AR} rc libvmlib_untrusted.a untrusted/*.o)
-
-add_custom_target (vmlib_untrusted ALL DEPENDS libvmlib_untrusted.a)
-
-execute_process (
- COMMAND bash -c "sed -i -E 's/^#define WASM_ENABLE_LIB_RATS 0/#define WASM_ENABLE_LIB_RATS 1/g' ${SGX_PLATFORM_DIR}/enclave-sample/Enclave/Enclave.edl"
- COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_LIB_RATS = 0/WAMR_BUILD_LIB_RATS = 1/g' ${SGX_PLATFORM_DIR}/enclave-sample/Makefile"
- OUTPUT_VARIABLE cmdOutput
-)
-
-################ wamr runtime ###################
-add_custom_target (
- iwasm ALL
- DEPENDS vmlib_untrusted vmlib_untrusted vmlib
- COMMAND make -C ${SGX_PLATFORM_DIR}/enclave-sample SGX_MODE=HW SGX_DEBUG=1 VMLIB_BUILD_DIR=${CMAKE_BINARY_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy ${SGX_PLATFORM_DIR}/enclave-sample/enclave.signed.so ${CMAKE_BINARY_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy ${SGX_PLATFORM_DIR}/enclave-sample/iwasm ${CMAKE_BINARY_DIR}
- COMMAND make -C ${SGX_PLATFORM_DIR}/enclave-sample clean)
-
-################ wasm application ###############
-add_subdirectory(wasm-app)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/README.md
deleted file mode 100644
index 39a2f2d9c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/README.md
+++ /dev/null
@@ -1,203 +0,0 @@
-"sgx-ra" sample introduction
-==============
-
-This sample demonstrates how to execute Remote Attestation on SGX with [librats](https://github.com/inclavare-containers/librats) and run it with iwasm. It can only build on [SGX supported processors](https://www.intel.com/content/www/us/en/support/articles/000028173/processors.html), please check it.
-
-## Preparation
-
-SGX-RA requires to have installed:
- - the WASI-SDK, located in `/opt/wasi-sdk`
- - CMake >= 3.11, which is not provided on Ubuntu 18.04 (use [Kitware APT Repository](https://apt.kitware.com/))
-
-### Intel SGX dependencies
-
-Before starting, we need to download and install [SGX SDK](https://download.01.org/intel-sgx/latest/linux-latest/distro) and [SGX DCAP Library](https://download.01.org/intel-sgx/latest/dcap-latest) referring to this [guide](https://download.01.org/intel-sgx/sgx-dcap/1.8/linux/docs/Intel_SGX_DCAP_Linux_SW_Installation_Guide.pdf).
-
-The following commands are an example of the SGX environment installation on Ubuntu 18.04.
-``` shell
-# Set your platform, you can get the platforms list on
-# https://download.01.org/intel-sgx/latest/linux-latest/distro
-$ cd $HOME
-$ SGX_PLATFORM=ubuntu18.04-server
-$ SGX_SDK_VERSION=2.17.100.3
-$ SGX_DRIVER_VERSION=1.41
-
-# install the dependencies
-$ sudo apt-get update
-$ sudo apt-get install -y dkms
-
-# install SGX Driver
-$ wget https://download.01.org/intel-sgx/latest/linux-latest/distro/$SGX_PLATFORM/sgx_linux_x64_driver_$SGX_DRIVER_VERSION.bin
-$ chmod +x sgx_linux_x64_driver_$SGX_DRIVER_VERSION.bin
-$ sudo ./sgx_linux_x64_driver_$SGX_DRIVER_VERSION.bin
-
-# install SGX SDK
-$ wget https://download.01.org/intel-sgx/latest/linux-latest/distro/$SGX_PLATFORM/sgx_linux_x64_sdk_$SGX_SDK_VERSION.bin
-$ chmod +x sgx_linux_x64_sdk_$SGX_SDK_VERSION.bin
-$ sudo ./sgx_linux_x64_sdk_$SGX_SDK_VERSION.bin
-
-# install SGX DCAP Library
-$ echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu bionic main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list > /dev/null
-$ wget -O - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
-$ sudo apt-get update
-$ sudo apt-get install -y libsgx-uae-service libsgx-dcap-default-qpl-dev libsgx-dcap-ql-dev libsgx-dcap-quote-verify-dev
-
-# install SGX SSL Library
-$ git clone https://github.com/intel/linux-sgx.git
-$ cd linux-sgx && make preparation
-$ sudo cp external/toolset/{current_distr}/* /usr/local/bin
-$ # Verify that the paths are correctly set
-$ which ar as ld objcopy objdump ranlib
-$ cd ../
-$ git clone https://github.com/intel/intel-sgx-ssl.git
-$ wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz
-$ cp openssl-1.1.1q.tar.gz intel-sgx-ssl/openssl_source
-$ rm -f openssl-1.1.1q.tar.gz
-$ cd intel-sgx-ssl/Linux
-$ source /opt/intel/sgxsdk/environment
-$ make all
-$ sudo make install
-```
-
-You can optionally grant users to communicate with the SDK platform using the following command.
-Otherwise, enclaves must be launched with root privileges.
-
-```shell
-sudo usermod -a -G sgx_prv <username>
-```
-
-### Intel Provisioning Certification Service (Intel PCS)
-
-Intel DCAP connects to Intel PCS to download the attestation collateral for SGX-enabled machines.
-Intel provides a [quick install guide](https://www.intel.com/content/www/us/en/developer/articles/guide/intel-software-guard-extensions-data-center-attestation-primitives-quick-install-guide.html) to set up a simplified environment.
-This section summarizes the commands to issue for setting up a working environment on Ubuntu 18.04.
-
-### Subscribe to Intel PCS Web services
-
-Intel SGX DCAP requires a complimentary subscription to the Intel PCS.
-To subscribe to the service, browse the [Intel SGX Software Services](https://api.portal.trustedservices.intel.com/) page.
-A the end of the subscription process, save the primary and the secondary keys.
-
-### Set up the Intel Provisioning Certification Caching Service (Intel PCCS)
-
-Intel PCCS is a caching mechanism for attestation collateral, preventing continuously communicating with Intel PCS during attestation.
-Intel provides an implementation of the cache mechanism.
-
-The following commands set up Intel PCCS.
-```shell
-# install Node.js
-$ curl -o setup.sh -sL https://deb.nodesource.com/setup_14.x
-$ chmod a+x setup.sh
-$ sudo ./setup.sh
-# install PCCS software
-$ sudo apt-get install -y cracklib-runtime sqlite3 python build-essential
-$ sudo apt-get install -y sgx-dcap-pccs
-```
-
-The installation will run the PCCS setup script, asking you several questions.
-
-```
-Do you want to configure PCCS now? (Y/N)
-```
-
-Answer "Y" to this question.
-
-```
-Set HTTPS listening port [8081] (1024-65535)
-```
-
-Accept the default listening port of 8081.
-
-```
-Set the PCCS service to accept local connections only? [Y] (Y/N)
-```
-
-Answer "N" to this question. We want the PCCS service to accept connections from other systems.
-
-```
-Set your Intel PCS API key (Press ENTER to skip)
-```
-
-Enter either your primary or secondary key retrieved from the previous subsection.
-If you already subscribed, you can retrieve them [here](https://api.portal.trustedservices.intel.com/developer).
-
-```
-Choose caching fill method : [LAZY] (LAZY/OFFLINE/REQ)
-```
-
-Answer "REQ" to this question. This places the caching service in the "on request" mode, which means it will fetch the attestation collateral for hosts as provisioning requests are received.
-
-```
-Set PCCS server administrator password:
-Re-enter administrator password:
-Set PCCS server user password:
-Re-enter user password:
-```
-
-Enter two passwords for the PCCS server.
-
-```
-Do you want to generate insecure HTTPS key and cert for PCCS service? [Y] (Y/N)
-```
-
-Answer "Y" to this question.
-
-### Provisioning a system into Intel PCCS
-
-Now that the PCCS is up and running, it's time to provision an Intel SGX-enabled platform.
-We use the tool `PCKIDRetrievalTool` to get the attestation collateral of the current machine.
-
-``` shell
-$ sudo apt-get install -y sgx-pck-id-retrieval-tool
-```
-
-Adapt the configuration file of `PCKIDRetrievalTool` located in `/opt/intel/sgx-pck-id-retrieval-tool/network_setting.conf` and make the following changes:
-- Change the **PCCS_URL** to match your caching service's location.
-- Uncomment the **user_token** parameter, and set it to the user password you created when configuring the PCCS.
-- Set the **proxy_type** to fit your environment (most likely, this will be `direct`)
-- Ensure **USE_SECURE_CERT** is set to `FALSE` since we're using a self-signed certificate for testing purposes.
-
-Save your changes and run the provisioning tool.
-
-```shell
-$ PCKIDRetrievalTool
-Intel(R) Software Guard Extensions PCK Cert ID Retrieval Tool Version 1.14.100.3
-
-the data has been sent to cache server successfully and pckid_retrieval.csv has been generated successfully!
-```
-
-You may get some warnings during this execution of the tool.
-A correct insertion into the cache server usually means the retrieval of the attestation collateral worked.
-Execute the following command to verify the collateral could be stored in your instance of Intel PCCS:
-
-```
-curl -k https://localhost:8081/sgx/certification/v3/qe/identity
-```
-
-This should print a JSON value with the attestation collateral.
-
-### Runtime configuration
-
-Edit the configuration file, `/etc/sgx_default_qcnl.conf`, and make the following changes:
-- Set the **PCCS_URL** parameter to the location of our PCCS server.
-- Set **USE_SECURE_CERT** to `FALSE` since we're using a self-signed certificate for testing purposes.
-
-This system is now ready to run Intel SGX workloads with generate evidence for remote attestation.
-
-## Build and executing the sample
-
-``` shell
-$ mkdir build && cd build
-$ cmake ..
-$ make
-$ # run the sample
-$ ./iwasm wasm-app/test.wasm
-```
-
-The sample will print the evidence in JSON and the message: *Evidence is trusted.*
-
-## Further readings
-
-- [Intel SGX Software Installation Guide For Linux OS](https://download.01.org/intel-sgx/latest/dcap-latest/linux/docs/Intel_SGX_SW_Installation_Guide_for_Linux.pdf)
-- [Intel Software Guard Extensions (Intel® SGX) Data Center Attestation Primitives: Library API ](https://download.01.org/intel-sgx/latest/dcap-latest/linux/docs/Intel_SGX_ECDSA_QuoteLibReference_DCAP_API.pdf)
-- [Remote Attestation for Multi-Package Platforms using Intel SGX Datacenter Attestation Primitives (DCAP)](https://download.01.org/intel-sgx/latest/dcap-latest/linux/docs/Intel_SGX_DCAP_Multipackage_SW.pdf)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/CMakeLists.txt
deleted file mode 100644
index afba7dfb6..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (c) 2022 Intel Corporation
-# Copyright (c) 2020-2021 Alibaba Cloud
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.0)
-project(wasm-app)
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
-set (LIB_RATS_DIR ${WAMR_ROOT_DIR}/core/iwasm/libraries/lib-rats)
-
-set (CMAKE_C_LINK_FLAGS "")
-set (CMAKE_CXX_LINK_FLAGS "")
-if (APPLE)
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
-endif ()
-
-set (CMAKE_SYSTEM_PROCESSOR wasm32)
-set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
-
-if (NOT DEFINED WASI_SDK_DIR)
- set (WASI_SDK_DIR "/opt/wasi-sdk")
-endif ()
-
-set (CMAKE_C_FLAGS "-nostdlib")
-set (CMAKE_C_COMPILER_TARGET "wasm32")
-set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
-
-set (CMAKE_EXE_LINKER_FLAGS
- "-Wl,--max-memory=131072 -z stack-size=8192 \
- -Wl,--no-entry,--strip-all \
- -Wl,--export=__main_argc_argv \
- -Wl,--export=__heap_base,--export=__data_end \
- -Wl,--allow-undefined"
-)
-
-add_executable(test.wasm main.c)
-set_target_properties(test.wasm PROPERTIES INCLUDE_DIRECTORIES ${LIB_RATS_DIR})
-target_link_libraries(test.wasm)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/main.c
deleted file mode 100644
index 89c4144aa..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/sgx-ra/wasm-app/main.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2022 Intel Corporation
- * Copyright (c) 2020-2021 Alibaba Cloud
- *
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "lib_rats_wrapper.h"
-
-#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
-
-/**
- * hex_dump
- *
- * @brief dump data in hex format
- *
- * @param title: Title
- * @param buf: User buffer
- * @param size: Dump data size
- * @param number: The number of outputs per line
- *
- * @return void
- */
-void
-hex_dump(const char *title, const uint8_t *buf, uint32_t size, uint32_t number)
-{
- int i, j;
- if (title) {
- printf("\n\t%s:\n\n", title);
- }
-
- for (i = 0; i < size; i += number) {
- printf("%08X: ", i);
-
- for (j = 0; j < number; j++) {
- if (j % 8 == 0) {
- printf(" ");
- }
- if (i + j < size)
- printf("%02X ", buf[i + j]);
- else
- printf(" ");
- }
- printf(" ");
-
- for (j = 0; j < number; j++) {
- if (i + j < size) {
- printf("%c", __is_print(buf[i + j]) ? buf[i + j] : '.');
- }
- }
- printf("\n");
- }
-}
-
-int
-main(int argc, char **argv)
-{
- int ret_code = -1;
- char *evidence_json = NULL;
-
- // Generate user_data by SHA256 buffer and the wasm module.
- // user_data = SHA256(sha256_wasm_module || buffer)
- const char *buffer = "This is a sample.";
-
- // If you want to declare the evidence of type rats_sgx_evidence_t on the
- // stack, you should modify the stack size of the CMAKE_EXE_LINKER_FLAGS in
- // CMakeLists.txt to 51200 at least.
- rats_sgx_evidence_t *evidence =
- (rats_sgx_evidence_t *)malloc(sizeof(rats_sgx_evidence_t));
- if (!evidence) {
- printf("ERROR: No memory to allocate.\n");
- goto err;
- }
-
- int rats_err = librats_collect(&evidence_json, buffer);
- if (rats_err != 0) {
- printf("ERROR: Collect evidence failed, error code: %#x\n", rats_err);
- goto err;
- }
-
- if (librats_parse_evidence(evidence_json, evidence) != 0) {
- printf("ERROR: Parse evidence failed.\n");
- goto err;
- }
-
- // You could use these parameters for further verification.
- hex_dump("Quote", evidence->quote, evidence->quote_size, 32);
- hex_dump("User Data", evidence->user_data, SGX_USER_DATA_SIZE, 32);
- hex_dump("MRENCLAVE", evidence->mr_enclave, SGX_MEASUREMENT_SIZE, 32);
- hex_dump("MRSIGNER", evidence->mr_signer, SGX_MEASUREMENT_SIZE, 32);
- printf("\n\tProduct ID:\t\t%u\n", evidence->product_id);
- printf("\tSecurity Version:\t%u\n", evidence->security_version);
- printf("\tAttributes.flags:\t%llu\n", evidence->att_flags);
- printf("\tAttribute.xfrm:\t\t%llu\n", evidence->att_xfrm);
-
- rats_err = librats_verify((const char *)evidence_json, evidence->user_data);
- if (rats_err != 0) {
- printf("ERROR: Evidence is not trusted, error code: %#x.\n", rats_err);
- goto err;
- }
-
- ret_code = 0;
- printf("Evidence is trusted.\n");
-
-err:
- if (evidence_json) {
- free(evidence_json);
- }
-
- if (evidence) {
- free(evidence);
- }
-
- return ret_code;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore
deleted file mode 100644
index e2e7327cd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/out
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt
deleted file mode 100644
index f3a0848fe..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 2.9)
-
-project (simple)
-
-################ wamr runtime settings ################
-message(STATUS "WAMR_BUILD_SDK_PROFILE=${WAMR_BUILD_SDK_PROFILE}")
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif ()
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-
-## use library and headers in the SDK
-link_directories(${WAMR_ROOT_DIR}/wamr-sdk/out/${WAMR_BUILD_SDK_PROFILE}/runtime-sdk/lib)
-include_directories(
- ${WAMR_ROOT_DIR}/wamr-sdk/out/${WAMR_BUILD_SDK_PROFILE}/runtime-sdk/include
- ${WAMR_ROOT_DIR}/core/shared/utils
- ${WAMR_ROOT_DIR}/core/shared/platform/linux
-)
-
-################ application related ################
-
-include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
-
-#Note: uncomment below line to use UART mode
-#add_definitions (-DCONNECTION_UART)
-
-add_executable (simple src/main.c src/iwasm_main.c)
-target_link_libraries (simple vmlib -lm -ldl -lpthread -lrt)
-
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md
deleted file mode 100644
index 5625212f9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md
+++ /dev/null
@@ -1,342 +0,0 @@
-
-
-"simple" sample introduction
-==============
-
-This sample demonstrates following scenarios:
-
-- Use tool "host_tool" to remotely install/uninstall wasm applications from the WAMR runtime over either TCP socket or UART cable
-- Inter-app communication programming models
-- Communication between WASM applications and the remote app host_tool
-- A number of WASM applications built on top of WAMR application framework API sets
-
-
-
-Directory structure
-------------------------------
-```
-simple/
-├── build.sh
-├── CMakeLists.txt
-├── README.md
-├── src
-│   ├── ext_lib_export.c
-│   ├── iwasm_main.c
-│   └── main.c
-└── wasm-apps
- ├── connection.c
- ├── event_publisher.c
- ├── event_subscriber.c
- ├── request_handler.c
- ├── request_sender.c
- ├── sensor.c
- └── timer.c
-```
-
-- src/ext_lib_export.c<br/>
- This file is used to export native APIs. See the `The mechanism of exporting Native API to WASM application` section in WAMR README.md for detail.
-- src/iwam_main.c<br/>
- This file is the implementation by platform integrator. It implements the interfaces that enable the application manager communicating with the host side. See `{WAMR_ROOT}/core/app-mgr/app-mgr-shared/app_manager_export.h` for the definition of the host interface.
-## Set physical communication between device and remote
-
-
-
-```
-/* Interfaces of host communication */
-typedef struct host_interface {
- host_init_func init;
- host_send_fun send;
- host_destroy_fun destroy;
-} host_interface;
-
-```
-The `host_init_func` is called when the application manager starts up. And `host_send_fun` is called by the application manager to send data to the host.
-
-Define a global variable "interface" of the data structure:
-
-```
-
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-```
-This interface is passed to application manager during the runtime startup:
-```
-app_manager_startup(&interface);
-```
-
->
-
-**Note:** The connection between simple and host_tool is TCP by default. The simple application works as a server and the host_tool works as a client. You can also use UART connection. To achieve this you have to uncomment the below line in CMakeLists.txt and rebuild.
-
-```
-#add_definitions (-DCONNECTION_UART)`
-```
-
-To run the UART based test, you have to set up a UART hardware connection between host_tool and the simple application. See the help of host_tool for how to specify UART device parameters.
-
-
-Build the sample
-==============
-Execute the build.sh script then all binaries including wasm application files would be generated in 'out' directory.
-
-```
-$ ./build.sh
-Enter build target profile (default=host-interp) -->
-arm-interp
-host-aot
-host-interp
-\>:
-
-```
-
-Enter the profile name for starting your build. "host-***" profiles build the sample for executing on your development machine, and "arm-interp" profile will do cross building for ARM target platform. If "arm-interp" is entered, please ensure the ARM cross compiler toolchain is already installed in your development machine. Your should set *ARM_A7_COMPILER_DIR* and *ARM_A7_SDKTARGETSYSROOT* environment variable in your ~/.bashrc correctly. refer to the file [profiles/arm-interp/toolchain.cmake](./profiles/arm-interp/toolchain.cmake).
-
-```
-~/.bashrc:
-export ARM_A7_COMPILER_DIR="/home/beihai/cross-toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin"
-export ARM_A7_SDKTARGETSYSROOT="/home/beihai/cross-toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf/libc"
-
-notes: please set the value to the actual path of your cross toolchain.
-```
-
-If you need to create additional profile for customizing your runtime, application framework or the target platforms, a new subfolder can be created under the *profiles* folder, and place your own version of "toolchain.cmake" and "wamr_config_simple.cmake" in it.
-
-```
-$wamr-root/samples/simple/profiles$ ls
-arm-interp host-aot host-interp
-$wamr-root/samples/simple/profiles$ ls arm-interp/
-toolchain.cmake wamr_config_simple.cmake
-
-```
-
-
-
-
-
-**Out directory structure**
-
-```
-out/
-├── host_tool
-├── simple
-└── wasm-apps
- ├── connection.wasm
- ├── event_publisher.wasm
- ├── event_subscriber.wasm
- ├── request_handler.wasm
- ├── request_sender.wasm
- ├── sensor.wasm
- └── timer.wasm
-```
-
-- host_tool:
- A small testing tool to interact with WAMR. See the usage of this tool by executing "./host_tool -h".
- `./host_tool -h`
-
-- simple:
- A simple testing tool running on the host side that interact with WAMR. It is used to install, uninstall and query WASM applications in WAMR, and send request or subscribe event, etc. See the usage of this application by executing "./simple -h".
- `./simple -h`
->
-
-Run the sample
-==========================
-- Enter the out directory
-```
-$ cd ./out/
-```
-
-- Startup the 'simple' process works in TCP server mode and you would see "App Manager started." is printed.
-```
-$ ./simple -s
-App Manager started.
-```
-
-- Query all installed applications
-```
-$ ./host_tool -q
-
-response status 69
-{
- "num": 0
-}
-```
-
-The `69` stands for response code SUCCESS. The payload is printed with JSON format where the `num` stands for application installations number and value `0` means currently no application is installed yet.
-
-- Install the request handler wasm application<br/>
-```
-$ ./host_tool -i request_handler -f ./wasm-apps/request_handler.wasm
-
-response status 65
-```
-Now the request handler application is running and waiting for host or other wasm application to send a request.
-
-- Query again
-```
-$ ./host_tool -q
-
-response status 69
-{
- "num": 1,
- "applet1": "request_handler",
- "heap1": 49152
-}
-```
-In the payload, we can see `num` is 1 which means 1 application is installed. `applet1`stands for the name of the 1st application. `heap1` stands for the heap size of the 1st application.
-
-- Send request from host to specific wasm application
-```
-$ ./host_tool -r /app/request_handler/url1 -A GET
-
-response status 69
-{
- "key1": "value1",
- "key2": "value2"
-}
-```
-
-We can see a response with status `69` and a payload is received.
-
-Output of simple application:
-```
-connection established!
-Send request to applet: request_handler
-Send request to app request_handler success.
-App request_handler got request, url url1, action 1
-[resp] ### user resource 1 handler called
-sent 150 bytes to host
-Wasm app process request success.
-```
-
-- Send a general request from host (not specify target application name)<br/>
-```
-$ ./host_tool -r /url1 -A GET
-
-response status 69
-{
- "key1": "value1",
- "key2": "value2"
-}
-```
-
-Output of simple application:
-```
-connection established!
-Send request to app request_handler success.
-App request_handler got request, url /url1, action 1
-[resp] ### user resource 1 handler called
-sent 150 bytes to host
-Wasm app process request success.
-```
-
-- Install the event publisher wasm application
-```
-$ ./host_tool -i pub -f ./wasm-apps/event_publisher.wasm
-
-response status 65
-```
-
-- Subscribe event by host_tool<br/>
-```
-$ ./host_tool -s /alert/overheat -a 3000
-
-response status 69
-
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-```
-We can see 4 `alert/overheat` events are received in 3 seconds which is published by the `pub` application.
-
-Output of simple
-```
-connection established!
-am_register_event adding url:(alert/overheat)
-client: -3 registered event (alert/overheat)
-sent 16 bytes to host
-sent 142 bytes to host
-sent 142 bytes to host
-sent 142 bytes to host
-sent 142 bytes to host
-```
-- Install the event subscriber wasm application<br/>
-```
-$ ./host_tool -i sub -f ./wasm-apps/event_subscriber.wasm
-
-response status 65
-```
-The `sub` application is installed.
-
-Output of simple
-```
-connection established!
-Install WASM app success!
-WASM app 'sub' started
-am_register_event adding url:(alert/overheat)
-client: 3 registered event (alert/overheat)
-sent 16 bytes to host
-Send request to app sub success.
-App sub got request, url alert/overheat, action 6
-### user over heat event handler called
-Attribute container dump:
-Tag:
-Attribute list:
- key: warning, type: string, value: temperature is over high
-
-Wasm app process request success.
-```
-
-We can see the `sub` application receives the `alert/overheat` event and dumps it out.<br/>
-At device side, the event is represented by an attribute container which contains key-value pairs like below:
-```
-Attribute container dump:
-Tag:
-Attribute list:
- key: warning, type: string, value: temperature is over high
-```
-`warning` is the key's name. `string` means this is a string value and `temperature is over high` is the value.
-
-- Uninstall the wasm application<br/>
-```
-$ ./host_tool -u request_handler
-
-response status 66
-
-$ ./host_tool -u pub
-
-response status 66
-
-$ ./host_tool -u sub
-
-response status 66
-```
-
-- Query again<br/>
-```
-$ ./host_tool -q
-
-response status 69
-{
- "num": 0
-}
-```
-
- >**Note:** Here we only installed part of the sample WASM applications. You can try others by yourself.
-
- >**Note:** You have to manually kill the simple process by Ctrl+C after use.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh
deleted file mode 100755
index 4e8155156..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh
+++ /dev/null
@@ -1,166 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-CURR_DIR=$PWD
-WAMR_DIR=${PWD}/../..
-OUT_DIR=${PWD}/out
-BUILD_DIR=${PWD}/build
-
-IWASM_ROOT=${PWD}/../../core/iwasm
-APP_FRAMEWORK_DIR=${PWD}/../../core/app-framework
-NATIVE_LIBS=${APP_FRAMEWORK_DIR}/app-native-shared
-APP_LIB_SRC="${APP_FRAMEWORK_DIR}/base/app/*.c ${APP_FRAMEWORK_DIR}/sensor/app/*.c \
- ${APP_FRAMEWORK_DIR}/connection/app/*.c ${NATIVE_LIBS}/*.c"
-WASM_APPS=${PWD}/wasm-apps
-CLEAN=
-CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
-CM_TOOLCHAIN=""
-
-usage ()
-{
- echo "build.sh [options]"
- echo " -p [profile]"
- echo " -d [target]"
- echo " -c, rebuild SDK"
- exit 1
-}
-
-
-while getopts "p:dch" opt
-do
- case $opt in
- p)
- PROFILE=$OPTARG
- ;;
- d)
- CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Debug"
- ;;
- c)
- CLEAN="TRUE"
- ;;
- h)
- usage
- exit 1;
- ;;
- ?)
- echo "Unknown arg: $arg"
- usage
- exit 1
- ;;
- esac
-done
-
-
-if [ "$CLEAN" = "TRUE" ]; then
- rm -rf $CURR_DIR/cmake-build
-fi
-
-
-while [ ! -n "$PROFILE" ]
-do
- support_profiles=`ls -l "profiles/" |grep '^d' | awk '{print $9}'`
- read -p "Enter build target profile (default=host-interp) -->
-$support_profiles
-\>:" read_platform
- if [ ! -n "$read_platform" ]; then
- PROFILE="host-interp"
- else
- PROFILE=$read_platform
- fi
-done
-
-ARG_TOOLCHAIN=""
-TOOL_CHAIN_FILE=$CURR_DIR/profiles/$PROFILE/toolchain.cmake
-if [ -f $TOOL_CHAIN_FILE ]; then
- CM_TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN_FILE"
- ARG_TOOLCHAIN="-t $TOOL_CHAIN_FILE"
- echo "toolchain file: $TOOL_CHAIN_FILE"
-fi
-
-
-SDK_CONFIG_FILE=$CURR_DIR/profiles/$PROFILE/wamr_config_simple.cmake
-if [ ! -f $SDK_CONFIG_FILE ]; then
- echo "SDK config file [$SDK_CONFIG_FILE] doesn't exit. quit.."
- exit 1
-fi
-
-
-
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-mkdir ${OUT_DIR}/wasm-apps
-
-cd ${WAMR_DIR}/core/shared/mem-alloc
-
-PROFILE="simple-$PROFILE"
-
-
-echo "#####################build wamr sdk"
-cd ${WAMR_DIR}/wamr-sdk
-./build_sdk.sh -n $PROFILE -x $SDK_CONFIG_FILE $ARG_TOOLCHAIN
-[ $? -eq 0 ] || exit $?
-
-
-echo "#####################build simple project"
-cd ${CURR_DIR}
-mkdir -p cmake-build/$PROFILE
-cd cmake-build/$PROFILE
-cmake ../.. -DWAMR_BUILD_SDK_PROFILE=$PROFILE $CM_TOOLCHAIN $CM_BUILD_TYPE
-make
-if [ $? != 0 ];then
- echo "BUILD_FAIL simple exit as $?\n"
- exit 2
-fi
-cp -a simple ${OUT_DIR}
-echo "#####################build simple project success"
-
-echo -e "\n\n"
-echo "#####################build host-tool"
-cd ${WAMR_DIR}/test-tools/host-tool
-mkdir -p bin
-cd bin
-cmake .. $CM_TOOLCHAIN $CM_BUILD_TYPE
-make
-if [ $? != 0 ];then
- echo "BUILD_FAIL host tool exit as $?\n"
- exit 2
-fi
-cp host_tool ${OUT_DIR}
-echo "#####################build host-tool success"
-
-echo -e "\n\n"
-echo "#####################build wasm apps"
-
-cd ${WASM_APPS}
-
-for i in `ls *.c`
-do
-APP_SRC="$i"
-OUT_FILE=${i%.*}.wasm
-
-/opt/wasi-sdk/bin/clang \
- -I${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/wamr-app-framework/include \
- -L${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/wamr-app-framework/lib \
- -lapp_framework \
- --target=wasm32 -O3 -z stack-size=4096 -Wl,--initial-memory=65536 \
- --sysroot=${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/libc-builtin-sysroot \
- -Wl,--allow-undefined-file=${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/libc-builtin-sysroot/share/defined-symbols.txt \
- -Wl,--strip-all,--no-entry -nostdlib \
- -Wl,--export=on_init -Wl,--export=on_destroy \
- -Wl,--export=on_request -Wl,--export=on_response \
- -Wl,--export=on_sensor_event -Wl,--export=on_timer_callback \
- -Wl,--export=on_connection_data \
- -Wl,--export=__heap_base -Wl,--export=__data_end \
- -o ${OUT_DIR}/wasm-apps/${OUT_FILE} ${APP_SRC}
-if [ -f ${OUT_DIR}/wasm-apps/${OUT_FILE} ]; then
- echo "build ${OUT_FILE} success"
-else
- echo "build ${OUT_FILE} fail"
-fi
-done
-
-echo "#####################build wasm apps done"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake
deleted file mode 100644
index 604141d0a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME Linux) # this one is important
-SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
-
-message(STATUS "*** ARM A7 toolchain file ***")
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
-
-
-if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
- SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
-endif ()
-
-if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
- SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
- #SET(CMAKE_SYSROOT SDKTARGETSYSROOT)
-endif ()
-
-message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
-message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
-
-SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}arm-linux-gnueabihf-gcc)
-SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}arm-linux-gnueabihf-g++)
-
-
-# this is the file system root of the target
-SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
-
-# search for programs in the build host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake
deleted file mode 100644
index 90bb2f8d1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET ARM)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 0)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake
deleted file mode 100644
index 182504fea..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME Linux) # this one is important
-SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
-
-message(STATUS "*** ARM A7 toolchain file ***")
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
-
-
-if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
- SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
-endif ()
-
-if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
- SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
-endif ()
-
-message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
-message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
-
-SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-gcc)
-SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-g++)
-
-
-# this is the file system root of the target
-SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
-
-# search for programs in the build host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake
deleted file mode 100644
index 7e6604885..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET AARCH64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_SIMD 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake
deleted file mode 100644
index 182504fea..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME Linux) # this one is important
-SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
-
-message(STATUS "*** ARM A7 toolchain file ***")
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
-
-
-if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
- SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
-endif ()
-
-if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
- SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
-endif ()
-
-message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
-message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
-
-SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-gcc)
-SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-g++)
-
-
-# this is the file system root of the target
-SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
-
-# search for programs in the build host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake
deleted file mode 100644
index 13fb9ac13..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET AARCH64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 0)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_SIMD 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake
deleted file mode 100644
index 1f8cf9f8f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake
deleted file mode 100644
index 1f8cf9f8f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake
deleted file mode 100644
index d13c06d97..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "darwin")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py
deleted file mode 100755
index 09c36db5e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py
+++ /dev/null
@@ -1,224 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-import argparse
-import shlex
-import subprocess
-import sys
-import time
-import traceback
-import glob
-
-WAMRC_CMD = "../../wamr-compiler/build/wamrc"
-
-def compile_wasm_files_to_aot(wasm_apps_dir):
- wasm_files = glob.glob(wasm_apps_dir + "/*.wasm")
- print("Compile wasm app into aot files")
- for wasm_file in wasm_files:
- aot_file = wasm_file[0 : len(wasm_file) - 5] + ".aot";
- cmd = [ WAMRC_CMD, "-o", aot_file, wasm_file ]
- subprocess.check_call(cmd)
-
-def start_server(cwd):
- """
- Startup the 'simple' process works in TCP server mode
- """
- app_server = subprocess.Popen(shlex.split("./simple -s "), cwd=cwd)
- return app_server
-
-
-def query_installed_application(cwd):
- """
- Query all installed applications
- """
- qry_prc = subprocess.run(
- shlex.split("./host_tool -q"), cwd=cwd, check=False, capture_output=True
- )
- assert qry_prc.returncode == 69
- return qry_prc.returncode, qry_prc.stdout
-
-
-def install_wasm_application(wasm_name, wasm_file, cwd):
- """
- Install a wasm application
- """
- inst_prc = subprocess.run(
- shlex.split(f"./host_tool -i {wasm_name} -f {wasm_file}"),
- cwd=cwd,
- check=False,
- capture_output=True,
- )
- assert inst_prc.returncode == 65
- return inst_prc.returncode, inst_prc.stdout
-
-
-def uninstall_wasm_application(wasm_name, cwd):
- """
- Uninstall a wasm application
- """
-
- unst_prc = subprocess.run(
- shlex.split(f"./host_tool -u {wasm_name}"),
- cwd=cwd,
- check=False,
- capture_output=True,
- )
- assert unst_prc.returncode == 66
- return unst_prc.returncode, unst_prc.stdout
-
-
-def send_get_to_wasm_application(wasm_name, url, cwd):
- """
- send a request (GET) from host to an applicaton
- """
- qry_prc = subprocess.run(
- shlex.split(f"./host_tool -r /app/{wasm_name}{url} -A GET"),
- cwd=cwd,
- check=False,
- capture_output=True,
- )
- assert qry_prc.returncode == 69
- return qry_prc.returncode, qry_prc.stdout
-
-
-def main():
- """
- GO!GO!!GO!!!
- """
- parser = argparse.ArgumentParser(description="run the sample and examine outputs")
- parser.add_argument("working_directory", type=str)
- parser.add_argument("--aot", action='store_true', help="Test with AOT")
- args = parser.parse_args()
-
- test_aot = False
- suffix = ".wasm"
- if not args.aot:
- print("Test with interpreter mode")
- else:
- print("Test with AOT mode")
- test_aot = True
- suffix = ".aot"
- wasm_apps_dir = args.working_directory + "/wasm-apps"
- compile_wasm_files_to_aot(wasm_apps_dir)
-
- ret = 1
- app_server = None
- try:
- app_server = start_server(args.working_directory)
-
- # wait for a second
- time.sleep(1)
-
- print("--> Install timer" + suffix + "...")
- install_wasm_application(
- "timer", "./wasm-apps/timer" + suffix, args.working_directory
- )
-
- # wait for a second
- time.sleep(3)
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Install event_publisher" + suffix + "...")
- install_wasm_application(
- "event_publisher",
- "./wasm-apps/event_publisher" + suffix,
- args.working_directory,
- )
-
- print("--> Install event_subscriber" + suffix + "...")
- install_wasm_application(
- "event_subscriber",
- "./wasm-apps/event_subscriber" + suffix,
- args.working_directory,
- )
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Uninstall timer" + suffix + "...")
- uninstall_wasm_application("timer", args.working_directory)
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Uninstall event_publisher" + suffix + "...")
- uninstall_wasm_application(
- "event_publisher",
- args.working_directory,
- )
-
- print("--> Uninstall event_subscriber" + suffix + "...")
- uninstall_wasm_application(
- "event_subscriber",
- args.working_directory,
- )
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Install request_handler" + suffix + "...")
- install_wasm_application(
- "request_handler",
- "./wasm-apps/request_handler" + suffix,
- args.working_directory,
- )
-
- print("--> Query again...")
- query_installed_application(args.working_directory)
-
- print("--> Install request_sender" + suffix + "...")
- install_wasm_application(
- "request_sender",
- "./wasm-apps/request_sender" + suffix,
- args.working_directory,
- )
-
- print("--> Send GET to the Wasm application named request_handler...")
- send_get_to_wasm_application("request_handler", "/url1", args.working_directory)
-
- print("--> Uninstall request_handler" + suffix + "...")
- uninstall_wasm_application(
- "request_handler",
- args.working_directory,
- )
-
- print("--> Uninstall request_sender" + suffix + "...")
- uninstall_wasm_application(
- "request_sender",
- args.working_directory,
- )
-
- # Install a wasm app named "__exit_app_manager__" just to make app manager exit
- # while the wasm app is uninstalled, so as to collect the code coverage data.
- # Only available when collecting code coverage is enabled.
- print("--> Install timer" + suffix + "...")
- install_wasm_application(
- "__exit_app_manager__", "./wasm-apps/timer" + suffix, args.working_directory
- )
-
- print("--> Uninstall timer" + suffix + "...")
- uninstall_wasm_application(
- "__exit_app_manager__",
- args.working_directory,
- )
-
- # wait for a second
- time.sleep(1)
-
- print("--> All pass")
- ret = 0
- except AssertionError:
- traceback.print_exc()
- finally:
- app_server.kill()
-
- return ret
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c
deleted file mode 100644
index 36fb35b12..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#ifndef CONNECTION_UART
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#else
-#include <termios.h>
-#endif
-
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <unistd.h>
-#include <strings.h>
-
-#include "runtime_lib.h"
-#include "runtime_timer.h"
-#include "native_interface.h"
-#include "app_manager_export.h"
-#include "bh_platform.h"
-#include "runtime_sensor.h"
-#include "bi-inc/attr_container.h"
-#include "module_wasm_app.h"
-#include "wasm_export.h"
-
-#define MAX 2048
-
-#ifndef CONNECTION_UART
-#define SA struct sockaddr
-static char *host_address = "127.0.0.1";
-static int port = 8888;
-#else
-static char *uart_device = "/dev/ttyS2";
-static int baudrate = B115200;
-#endif
-
-extern bool
-init_sensor_framework();
-extern void
-exit_sensor_framework();
-extern void
-exit_connection_framework();
-extern int
-aee_host_msg_callback(void *msg, uint32_t msg_len);
-extern bool
-init_connection_framework();
-
-#ifndef CONNECTION_UART
-int listenfd = -1;
-int sockfd = -1;
-static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
-#else
-int uartfd = -1;
-#endif
-
-#ifndef CONNECTION_UART
-static bool server_mode = false;
-
-// Function designed for chat between client and server.
-void *
-func(void *arg)
-{
- char buff[MAX];
- int n;
- struct sockaddr_in servaddr;
-
- while (1) {
- if (sockfd != -1)
- close(sockfd);
- // socket create and verification
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd == -1) {
- printf("socket creation failed...\n");
- return NULL;
- }
- else
- printf("Socket successfully created..\n");
- bzero(&servaddr, sizeof(servaddr));
- // assign IP, PORT
- servaddr.sin_family = AF_INET;
- servaddr.sin_addr.s_addr = inet_addr(host_address);
- servaddr.sin_port = htons(port);
-
- // connect the client socket to server socket
- if (connect(sockfd, (SA *)&servaddr, sizeof(servaddr)) != 0) {
- printf("connection with the server failed...\n");
- sleep(10);
- continue;
- }
- else {
- printf("connected to the server..\n");
- }
-
- // infinite loop for chat
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
- // print buffer which contains the client contents
- // fprintf(stderr, "recieved %d bytes from host: %s", n, buff);
-
- // socket disconnected
- if (n <= 0)
- break;
-
- aee_host_msg_callback(buff, n);
- }
- }
-
- // After chatting close the socket
- close(sockfd);
-}
-
-static bool
-host_init()
-{
- return true;
-}
-
-int
-host_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- if (pthread_mutex_trylock(&sock_lock) == 0) {
- if (sockfd == -1) {
- pthread_mutex_unlock(&sock_lock);
- return 0;
- }
-
- ret = write(sockfd, buf, size);
-
- pthread_mutex_unlock(&sock_lock);
- return ret;
- }
-
- return -1;
-}
-
-void
-host_destroy()
-{
- if (server_mode)
- close(listenfd);
-
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- pthread_mutex_unlock(&sock_lock);
-}
-
-/* clang-format off */
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-/* clang-format on */
-
-/* Change it to 1 when fuzzing test */
-#define WASM_ENABLE_FUZZ_TEST 0
-
-void *
-func_server_mode(void *arg)
-{
- int clilent;
- struct sockaddr_in serv_addr, cli_addr;
- int n;
- char buff[MAX];
- struct sigaction sa;
-
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGPIPE, &sa, 0);
-
- /* First call to socket() function */
- listenfd = socket(AF_INET, SOCK_STREAM, 0);
-
- if (listenfd < 0) {
- perror("ERROR opening socket");
- exit(1);
- }
-
- /* Initialize socket structure */
- bzero((char *)&serv_addr, sizeof(serv_addr));
-
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = INADDR_ANY;
- serv_addr.sin_port = htons(port);
-
- /* Now bind the host address using bind() call.*/
- if (bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
- perror("ERROR on binding");
- exit(1);
- }
-
- listen(listenfd, 5);
- clilent = sizeof(cli_addr);
-
- while (1) {
- pthread_mutex_lock(&sock_lock);
-
- sockfd = accept(listenfd, (struct sockaddr *)&cli_addr, &clilent);
-
- pthread_mutex_unlock(&sock_lock);
-
- if (sockfd < 0) {
- perror("ERROR on accept");
- exit(1);
- }
-
- printf("connection established!\n");
-
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
-
- // socket disconnected
- if (n <= 0) {
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- sockfd = -1;
- pthread_mutex_unlock(&sock_lock);
-
- sleep(1);
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
-#if WASM_ENABLE_FUZZ_TEST != 0
- /* Exit the process when host disconnect.
- This is helpful for reproducing failure case. */
- close(sockfd);
- exit(1);
-#endif
- }
-}
-
-#else
-static int
-parse_baudrate(int baud)
-{
- switch (baud) {
- case 9600:
- return B9600;
- case 19200:
- return B19200;
- case 38400:
- return B38400;
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
- case 2500000:
- return B2500000;
- case 3000000:
- return B3000000;
- case 3500000:
- return B3500000;
- case 4000000:
- return B4000000;
- default:
- return -1;
- }
-}
-static bool
-uart_init(const char *device, int baudrate, int *fd)
-{
- int uart_fd;
- struct termios uart_term;
-
- uart_fd = open(device, O_RDWR | O_NOCTTY);
-
- if (uart_fd <= 0)
- return false;
-
- memset(&uart_term, 0, sizeof(uart_term));
- uart_term.c_cflag = baudrate | CS8 | CLOCAL | CREAD;
- uart_term.c_iflag = IGNPAR;
- uart_term.c_oflag = 0;
-
- /* set noncanonical mode */
- uart_term.c_lflag = 0;
- uart_term.c_cc[VTIME] = 30;
- uart_term.c_cc[VMIN] = 1;
- tcflush(uart_fd, TCIFLUSH);
-
- if (tcsetattr(uart_fd, TCSANOW, &uart_term) != 0) {
- close(uart_fd);
- return false;
- }
-
- *fd = uart_fd;
-
- return true;
-}
-
-static void *
-func_uart_mode(void *arg)
-{
- int n;
- char buff[MAX];
-
- if (!uart_init(uart_device, baudrate, &uartfd)) {
- printf("open uart fail! %s\n", uart_device);
- return NULL;
- }
-
- for (;;) {
- bzero(buff, MAX);
-
- n = read(uartfd, buff, sizeof(buff));
-
- if (n <= 0) {
- close(uartfd);
- uartfd = -1;
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
-
- return NULL;
-}
-
-static int
-uart_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- ret = write(uartfd, buf, size);
-
- return ret;
-}
-
-static void
-uart_destroy()
-{
- close(uartfd);
-}
-
-/* clang-format off */
-static host_interface interface = {
- .send = uart_send,
- .destroy = uart_destroy
-};
-/* clang-format on */
-
-#endif
-
-static attr_container_t *
-read_test_sensor(void *sensor)
-{
- attr_container_t *attr_obj = attr_container_create("read test sensor data");
- if (attr_obj) {
- bool ret =
- attr_container_set_string(&attr_obj, "name", "read test sensor");
- if (!ret) {
- attr_container_destroy(attr_obj);
- return NULL;
- }
- return attr_obj;
- }
- return NULL;
-}
-
-static bool
-config_test_sensor(void *s, void *config)
-{
- return false;
-}
-
-static char global_heap_buf[1024 * 1024] = { 0 };
-
-/* clang-format off */
-static void
-showUsage()
-{
-#ifndef CONNECTION_UART
- printf("Usage:\n");
- printf("\nWork as TCP server mode:\n");
- printf("\tsimple -s|--server_mode -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Port> represents the port that would be listened on and the default is 8888\n");
- printf("\nWork as TCP client mode:\n");
- printf("\tsimple -a|--host_address <Host Address> -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Host Address> represents the network address of host and the default is 127.0.0.1\n");
- printf("\t<Port> represents the listen port of host and the default is 8888\n");
-#else
- printf("Usage:\n");
- printf("\tsimple -u <Uart Device> -b <Baudrate>\n\n");
- printf("where\n");
- printf("\t<Uart Device> represents the UART device name and the default is /dev/ttyS2\n");
- printf("\t<Baudrate> represents the UART device baudrate and the default is 115200\n");
-#endif
-}
-/* clang-format on */
-
-static bool
-parse_args(int argc, char *argv[])
-{
- int c;
-
- while (1) {
- int optIndex = 0;
- static struct option longOpts[] = {
-#ifndef CONNECTION_UART
- { "server_mode", no_argument, NULL, 's' },
- { "host_address", required_argument, NULL, 'a' },
- { "port", required_argument, NULL, 'p' },
-#else
- { "uart", required_argument, NULL, 'u' },
- { "baudrate", required_argument, NULL, 'b' },
-#endif
- { "help", required_argument, NULL, 'h' },
- { 0, 0, 0, 0 }
- };
-
- c = getopt_long(argc, argv, "sa:p:u:b:w:h", longOpts, &optIndex);
- if (c == -1)
- break;
-
- switch (c) {
-#ifndef CONNECTION_UART
- case 's':
- server_mode = true;
- break;
- case 'a':
- host_address = optarg;
- printf("host address: %s\n", host_address);
- break;
- case 'p':
- port = atoi(optarg);
- printf("port: %d\n", port);
- break;
-#else
- case 'u':
- uart_device = optarg;
- printf("uart device: %s\n", uart_device);
- break;
- case 'b':
- baudrate = parse_baudrate(atoi(optarg));
- printf("uart baudrate: %s\n", optarg);
- break;
-#endif
- case 'h':
- showUsage();
- return false;
- default:
- showUsage();
- return false;
- }
- }
-
- return true;
-}
-
-// Driver function
-int
-iwasm_main(int argc, char *argv[])
-{
- RuntimeInitArgs init_args;
- korp_tid tid;
-
- if (!parse_args(argc, argv))
- return -1;
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
-#if USE_GLOBAL_HEAP_BUF != 0
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-#else
- init_args.mem_alloc_type = Alloc_With_Allocator;
- init_args.mem_alloc_option.allocator.malloc_func = malloc;
- init_args.mem_alloc_option.allocator.realloc_func = realloc;
- init_args.mem_alloc_option.allocator.free_func = free;
-#endif
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- /* connection framework */
- if (!init_connection_framework()) {
- goto fail1;
- }
-
- /* sensor framework */
- if (!init_sensor_framework()) {
- goto fail2;
- }
-
- /* timer manager */
- if (!init_wasm_timer()) {
- goto fail3;
- }
-
- /* add the sys sensor objects */
- add_sys_sensor("sensor_test1", "This is a sensor for test", 0, 1000,
- read_test_sensor, config_test_sensor);
- add_sys_sensor("sensor_test2", "This is a sensor for test", 0, 1000,
- read_test_sensor, config_test_sensor);
- start_sensor_framework();
-
-#ifndef CONNECTION_UART
- if (server_mode)
- os_thread_create(&tid, func_server_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
- else
- os_thread_create(&tid, func, NULL, BH_APPLET_PRESERVED_STACK_SIZE);
-#else
- os_thread_create(&tid, func_uart_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
-#endif
-
- app_manager_startup(&interface);
-
- exit_wasm_timer();
-
-fail3:
- exit_sensor_framework();
-
-fail2:
- exit_connection_framework();
-
-fail1:
- wasm_runtime_destroy();
-
- return -1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c
deleted file mode 100644
index e603420ee..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-extern void
-iwasm_main();
-
-int
-main(int argc, char *argv[])
-{
- iwasm_main(argc, argv);
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c
deleted file mode 100644
index d8efefdcf..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/connection.h"
-#include "wa-inc/timer_wasm_app.h"
-#include "wa-inc/request.h"
-
-/* User global variable */
-static int num = 0;
-static user_timer_t g_timer;
-static connection_t *g_conn = NULL;
-
-void
-on_data1(connection_t *conn, conn_event_type_t type, const char *data,
- uint32 len, void *user_data)
-{
- if (type == CONN_EVENT_TYPE_DATA) {
- char message[64] = { 0 };
- memcpy(message, data, len);
- printf("Client got a message from server -> %s\n", message);
- }
- else if (type == CONN_EVENT_TYPE_DISCONNECT) {
- printf("connection is close by server!\n");
- }
- else {
- printf("error: got unknown event type!!!\n");
- }
-}
-
-/* Timer callback */
-void
-timer1_update(user_timer_t timer)
-{
- char message[64] = { 0 };
- /* Reply to server */
- snprintf(message, sizeof(message), "Hello %d", num++);
- api_send_on_connection(g_conn, message, strlen(message));
-}
-
-void
-my_close_handler(request_t *request)
-{
- response_t response[1];
-
- if (g_conn != NULL) {
- api_timer_cancel(g_timer);
- api_close_connection(g_conn);
- }
-
- make_response_for_request(request, response);
- set_response(response, DELETED_2_02, 0, NULL, 0);
- api_response_send(response);
-}
-
-void
-on_init()
-{
- user_timer_t timer;
- attr_container_t *args;
- char *str = "this is client!";
-
- api_register_resource_handler("/close", my_close_handler);
-
- args = attr_container_create("");
- attr_container_set_string(&args, "address", "127.0.0.1");
- attr_container_set_uint16(&args, "port", 7777);
-
- g_conn = api_open_connection("TCP", args, on_data1, NULL);
- if (g_conn == NULL) {
- printf("connect to server fail!\n");
- return;
- }
-
- printf("connect to server success! handle: %p\n", g_conn);
-
- /* set up a timer */
- timer = api_timer_create(1000, true, false, timer1_update);
- api_timer_restart(timer, 1000);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c
deleted file mode 100644
index 2fa4418ca..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-#include "wa-inc/timer_wasm_app.h"
-
-int num = 0;
-
-void
-publish_overheat_event()
-{
- attr_container_t *event;
-
- event = attr_container_create("event");
- attr_container_set_string(&event, "warning", "temperature is over high");
-
- api_publish_event("alert/overheat", FMT_ATTR_CONTAINER, event,
- attr_container_get_serialize_length(event));
-
- attr_container_destroy(event);
-}
-
-/* Timer callback */
-void
-timer1_update(user_timer_t timer)
-{
- publish_overheat_event();
-}
-
-void
-start_timer()
-{
- user_timer_t timer;
-
- /* set up a timer */
- timer = api_timer_create(1000, true, false, timer1_update);
- api_timer_restart(timer, 1000);
-}
-
-void
-on_init()
-{
- start_timer();
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c
deleted file mode 100644
index 7ebd309e7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-
-void
-over_heat_event_handler(request_t *request)
-{
- printf("### user over heat event handler called\n");
-
- if (request->payload != NULL && request->fmt == FMT_ATTR_CONTAINER)
- attr_container_dump((attr_container_t *)request->payload);
-}
-
-void
-on_init()
-{
- api_subscribe_event("alert/overheat", over_heat_event_handler);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c
deleted file mode 100644
index be6c56030..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-
-static void
-url1_request_handler(request_t *request)
-{
- response_t response[1];
- attr_container_t *payload;
-
- printf("[resp] ### user resource 1 handler called\n");
-
- if (request->payload != NULL && request->fmt == FMT_ATTR_CONTAINER)
- attr_container_dump((attr_container_t *)request->payload);
-
- payload = attr_container_create("wasm app response payload");
- if (payload == NULL)
- return;
-
- attr_container_set_string(&payload, "key1", "value1");
- attr_container_set_string(&payload, "key2", "value2");
-
- make_response_for_request(request, response);
- set_response(response, CONTENT_2_05, FMT_ATTR_CONTAINER, (void *)payload,
- attr_container_get_serialize_length(payload));
- api_response_send(response);
-
- attr_container_destroy(payload);
-}
-
-static void
-url2_request_handler(request_t *request)
-{
- response_t response[1];
- make_response_for_request(request, response);
- set_response(response, DELETED_2_02, 0, NULL, 0);
- api_response_send(response);
-
- printf("### user resource 2 handler called\n");
-}
-
-void
-on_init()
-{
- /* register resource uri */
- api_register_resource_handler("/url1", url1_request_handler);
- api_register_resource_handler("/url2", url2_request_handler);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c
deleted file mode 100644
index 823f7f62c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-
-static void
-my_response_handler(response_t *response, void *user_data)
-{
- char *tag = (char *)user_data;
-
- if (response == NULL) {
- printf("[req] request timeout!\n");
- return;
- }
-
- printf("[req] response handler called mid:%d, status:%d, fmt:%d, "
- "payload:%p, len:%d, tag:%s\n",
- response->mid, response->status, response->fmt, response->payload,
- response->payload_len, tag);
-
- if (response->payload != NULL && response->payload_len > 0
- && response->fmt == FMT_ATTR_CONTAINER) {
- printf("[req] dump the response payload:\n");
- attr_container_dump((attr_container_t *)response->payload);
- }
-}
-
-static void
-test_send_request(char *url, char *tag)
-{
- request_t request[1];
-
- init_request(request, url, COAP_PUT, 0, NULL, 0);
- api_send_request(request, my_response_handler, tag);
-}
-
-void
-on_init()
-{
- test_send_request("/app/request_handler/url1", "a request to target app");
- test_send_request("url1", "a general request");
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c
deleted file mode 100644
index c45ff67d9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/sensor.h"
-
-static sensor_t sensor1 = NULL;
-static sensor_t sensor2 = NULL;
-static char *user_data = NULL;
-
-/* Sensor event callback*/
-void
-sensor_event_handler(sensor_t sensor, attr_container_t *event, void *user_data)
-{
- if (sensor == sensor1) {
- printf("### app get sensor event from sensor1\n");
- attr_container_dump(event);
- }
- else {
- printf("### app get sensor event from sensor2\n");
- attr_container_dump(event);
- }
-}
-
-void
-on_init()
-{
- attr_container_t *config;
-
- printf("### app on_init 1\n");
- /* open a sensor */
- user_data = malloc(100);
- if (!user_data) {
- printf("allocate memory failed\n");
- return;
- }
-
- printf("### app on_init 2\n");
- sensor1 = sensor_open("sensor_test1", 0, sensor_event_handler, user_data);
- if (!sensor1) {
- printf("open sensor1 failed\n");
- return;
- }
- /* config the sensor */
- sensor_config(sensor1, 1000, 0, 0);
-
- printf("### app on_init 3\n");
- sensor2 = sensor_open("sensor_test2", 0, sensor_event_handler, user_data);
- if (!sensor2) {
- printf("open sensor2 failed\n");
- return;
- }
- /* config the sensor */
- sensor_config(sensor2, 5000, 0, 0);
-
- printf("### app on_init 4\n");
- /*
- config = attr_container_create("sensor config");
- sensor_config(sensor, config);
- attr_container_destroy(config);
- */
-}
-
-void
-on_destroy()
-{
- if (NULL != sensor1) {
- sensor_config(sensor1, 0, 0, 0);
- }
-
- if (NULL != sensor2) {
- sensor_config(sensor2, 0, 0, 0);
- }
-
- if (NULL != user_data) {
- free(user_data);
- }
-
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c
deleted file mode 100644
index 5bf0822cd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/timer_wasm_app.h"
-
-/* User global variable */
-static int num = 0;
-
-/* Timer callback */
-void
-timer1_update(user_timer_t timer)
-{
- printf("Timer update %d\n", num++);
-}
-
-void
-on_init()
-{
- user_timer_t timer;
-
- /* set up a timer */
- timer = api_timer_create(1000, true, false, timer1_update);
- api_timer_restart(timer, 1000);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/CMakeLists.txt
deleted file mode 100644
index e68a63eb0..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/CMakeLists.txt
+++ /dev/null
@@ -1,195 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-
-include(CheckPIESupported)
-
-project(socket_api_sample)
-
-#######################################
-## Detect toolchain
-#######################################
-message(CHECK_START "Detecting WASI-SDK at /opt/wasi-sdk")
-if(NOT (DEFINED WASI_SDK_DIR OR DEFINED CACHE{WASI_SDK_DIR}))
- find_path(WASI_SDK_PARENT
- wasi-sdk
- PATHS /opt
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
- )
- if(WASI_SDK_PARENT)
- set(WASI_SDK_DIR ${WASI_SDK_PARENT}/wasi-sdk)
- endif()
-endif()
-if(WASI_SDK_DIR)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-if(NOT EXISTS ${WASI_SDK_DIR})
- message(FATAL_ERROR "Please install WASI-SDK under /opt/wasi-sdk")
-endif()
-
-message(CHECK_START "Detecting WASI_TOOLCHAIN_FILE at ${WASI_SDK_DIR}")
-find_file(WASI_TOOLCHAIN_FILE
- wasi-sdk.cmake
- PATHS "${WASI_SDK_DIR}/share/cmake"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASI_TOOLCHAIN_FILE)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-if(WASI_TOOLCHAIN_FILE-NOTFOUND)
- message(FATAL_ERROR "Can not find wasi-sdk.cmake under ${WASI_SDK_DIR}")
-endif()
-
-message(CHECK_START "Detecting WASI_SYS_ROOT at ${WASI_SDK_DIR}")
-find_path(WASI_SYS_ROOT
- wasi-sysroot
- PATHS "${WASI_SDK_DIR}/share"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASI_SYS_ROOT)
- message(CHECK_PASS "found")
- set(WASI_SYS_ROOT ${WASI_SYS_ROOT}/wasi-sysroot)
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-if(WASI_SYS_ROOT-NOTFOUND)
- message(FATAL_ERROR "Can not find wasi-sysroot/ under ${WASI_SDK_DIR}")
-endif()
-
-message(STATUS "WASI_SDK_DIR is ${WASI_SDK_DIR}")
-message(STATUS "WASI_TOOLCHAIN_FILE is ${WASI_TOOLCHAIN_FILE}")
-message(STATUS "WASI_SYS_ROOT is ${WASI_SYS_ROOT}")
-
-###############################################################
-## Build socket applications of wasm version and native version
-###############################################################
-include(ExternalProject)
-
-ExternalProject_Add(wasm-app
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src
- UPDATE_COMMAND ""
- PATCH_COMMAND ""
- CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_SOURCE_DIR}/../../wamr-sdk/app/libc-builtin-sysroot/include/pthread.h
- ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/inc
- && ${CMAKE_COMMAND}
- -DWASI_SDK_PREFIX=${WASI_SDK_DIR}
- -DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
- -DCMAKE_SYSROOT=${WASI_SYS_ROOT}
- ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src
- BUILD_COMMAND ${CMAKE_COMMAND} --build .
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
- addr_resolve.wasm ${CMAKE_BINARY_DIR}
- tcp_client.wasm ${CMAKE_BINARY_DIR}
- tcp_server.wasm ${CMAKE_BINARY_DIR}
- send_recv.wasm ${CMAKE_BINARY_DIR}
- socket_opts.wasm ${CMAKE_BINARY_DIR}
- udp_client.wasm ${CMAKE_BINARY_DIR}
- udp_server.wasm ${CMAKE_BINARY_DIR}
- multicast_client.wasm ${CMAKE_BINARY_DIR}
- multicast_server.wasm ${CMAKE_BINARY_DIR}
- timeout_client.wasm ${CMAKE_BINARY_DIR}
- timeout_server.wasm ${CMAKE_BINARY_DIR}
-)
-
-add_executable(tcp_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/tcp_server.c)
-target_link_libraries(tcp_server pthread)
-
-add_executable(tcp_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/tcp_client.c)
-
-add_executable(send_recv ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/send_recv.c)
-target_link_libraries(send_recv pthread)
-
-add_executable(addr_resolve ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/addr_resolve.c)
-
-add_executable(socket_opts ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/socket_opts.c)
-
-add_executable(udp_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/udp_client.c)
-
-add_executable(udp_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/udp_server.c)
-
-add_executable(multicast_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/multicast_client.c)
-
-add_executable(multicast_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/multicast_server.c)
-
-add_executable(timeout_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/timeout_client.c)
-
-add_executable(timeout_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/timeout_server.c)
-
-############################################
-## Build iwasm with wasi and pthread support
-############################################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Reset linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# Set WAMR features
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set(WAMR_BUILD_INTERP 1)
-set(WAMR_BUILD_FAST_INTERP 1)
-set(WAMR_BUILD_AOT 1)
-set(WAMR_BUILD_JIT 0)
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_LIBC_WASI 1)
-set(WAMR_BUILD_LIB_PTHREAD 1)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-
-# build vmlib static lib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-
-# build iwasm
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-set (RUNTIME_SOURCE_ALL
- ${CMAKE_CURRENT_LIST_DIR}/../../product-mini/platforms/linux/main.c
- ${UNCOMMON_SHARED_SOURCE}
-)
-add_executable (iwasm ${RUNTIME_SOURCE_ALL})
-check_pie_supported()
-set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_link_libraries(iwasm vmlib -lpthread -lm -ldl)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/README.md
deleted file mode 100644
index a3bc5ac15..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/README.md
+++ /dev/null
@@ -1,212 +0,0 @@
-# "socket-api" sample introduction
-
-This sample demonstrates how to use WAMR socket-api to develop wasm network applications.
-Two wasm applications are provided: tcp-server and tcp-client, and this sample demonstrates
-how they communicate with each other.
-
-## Preparation
-
-Please install WASI SDK, download the [wasi-sdk release](https://github.com/CraneStation/wasi-sdk/releases) and extract the archive to default path `/opt/wasi-sdk`.
-And install wabt, download the [wabt release](https://github.com/WebAssembly/wabt/releases) and extract the archive to default path `/opt/wabt`
-
-## Build the sample
-
-```bash
-mkdir build
-cd build
-cmake ..
-make
-```
-
-`iwasm` and the following Wasm modules (along with their corresponding native version) will be generated:
- * `addr_resolve.wasm`, `addr_resolve`
- * `send_recv.wasm`, `send_recv`
- * `socket_opts.wasm`, `socket_opts`
- * `tcp_client.wasm`, `tcp_client`
- * `tcp_server.wasm`, `tcp_server`
- * `udp_client.wasm`, `udp_client`
- * `udp_server.wasm`, `udp_server`
-
-> Note that iwasm is built with libc-wasi and lib-pthread enabled.
-
-## Run workload
-
-### TCP client/server
-
-Start the tcp server, which opens port 1234 and waits for clients to connect.
-
-```bash
-cd build
-./iwasm --addr-pool=0.0.0.0/15 tcp_server.wasm
-```
-
-Start the tcp client, which connects the server and receives message.
-
-```bash
-cd build
-./iwasm --addr-pool=127.0.0.1/15 tcp_client.wasm
-```
-
-The output of client is like:
-
-```bash
-[Client] Create socket
-[Client] Connect socket
-[Client] Client receive
-[Client] 115 bytes received:
-Buffer recieved:
-Say Hi from the Server
-Say Hi from the Server
-Say Hi from the Server
-Say Hi from the Server
-Say Hi from the Server
-
-[Client] BYE
-```
-
-`send_recv.wasm` contains a thread as a server and a thread as a client. They
-send and receive data via 127.0.0.1:1234.
-
-```bash
-$ ./iwasm --addr-pool=127.0.0.1/0 ./send_recv.wasm
-```
-
-The output is:
-
-```bash
-Server is online ...
-Client is running...
-Start receiving.
-Start sending.
-Send 106 bytes successfully!
-Receive 106 bytes successlly!
-Data:
- The stars shine down
- It brings us light
- Light comes down
- To make us paths
- It watches us
- And mourns for us
-```
-
-### Socket options
-
-`socket_opts.wasm` shows an example of getting and setting various supported socket options
-```bash
-$ ./iwasm socket_opts.wasm
-```
-The output is:
-```bash
-[Client] Create TCP socket
-[Client] Create UDP socket
-[Client] Create UDP IPv6 socket
-setsockopt SO_RCVTIMEO result is expected
-getsockopt SO_RCVTIMEO result is expected
-...
-[Client] Close sockets
-```
-
-The `timeout_client.wasm` and `timeout_server.wasm` examples demonstrate socket send and receive timeouts using the socket options. Start the server, then start the client.
-
-```bash
-$ ./iwasm --addr-pool=0.0.0.0/15 timeout_server.wasm
-```
-
-The output is:
-
-```bash
-Wait for client to connect
-Client connected, sleeping for 10s
-Shuting down
-```
-
-```bash
-$ ./iwasm --addr-pool=127.0.0.1/15 timeout_client.wasm
-```
-
-The output is:
-
-```bash
-Waiting on recv, which should timeout
-Waiting on send, which should timeout
-Success. Closing socket
-```
-
-The `multicast_client` and `multicast_server` examples demonstrate receiving multicast packets in WASM. Start the client and then the server with a multicast IP address and port.
-
-```bash
-$ ./iwasm --addr-pool=0.0.0.0/0,::/0 multicast_client.wasm <Multicast IP> <Port>
-$ ./iwasm --addr-pool=0.0.0.0/0,::/0 multicast_client.wasm 224.0.0.1
-$ ./iwasm --addr-pool=0.0.0.0/0,::/0 multicast_client.wasm FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2
-```
-
-The output should be
-
-```bash
-Joined multicast group. Waiting for datagram...
-Reading datagram message...OK.
-The message from multicast server is: "Test message"
-```
-
-```bash
-$ ./multicast_server <Multicast IP> <Port>
-$ ./multicast_server 224.0.0.1
-$ ./multicast_server FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2
-```
-
-The output should be
-
-```bash
-Datagram sent
-```
-
-### Domain name server resolution
-
-`addr_resolve.wasm` demonstrates the usage of resolving a domain name
-```
-$ ./iwasm --allow-resolve=*.com addr_resolve.wasm github.com
-```
-
-The command displays the host name and its corresponding IP address:
-```
-Host: github.com
-IPv4 address: 140.82.121.4 (TCP)
-```
-
-### UDP client/server
-
-Start the UDP server, which opens port 1234 and waits for clients to send a message.
-
-```bash
-cd build
-./iwasm --addr-pool=0.0.0.0/15 udp_server.wasm
-```
-
-Start the tcp client, which sends a message to the server and waits for the response.
-
-```bash
-cd build
-./iwasm --addr-pool=127.0.0.1/15 udp_client.wasm
-```
-
-The output of client is like:
-
-```bash
-[Client] Create socket
-[Client] Client send
-[Client] Client receive
-[Client] Buffer recieved: Hello from server
-[Client] BYE
-```
-
-The output of the server is like:
-```
-[Server] Create socket
-[Server] Bind socket
-[Server] Wait for clients to connect ..
-[Server] received 17 bytes from 127.0.0.1:60927: Hello from client
-```
-
-## Documentation
-
-Refer to [socket api document](../../doc/socket_api.md) for more details.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/sample_test_run.py b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/sample_test_run.py
deleted file mode 100755
index ec0060281..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/sample_test_run.py
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2023 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-import argparse
-import shlex
-import subprocess
-import sys
-import time
-import traceback
-import glob
-
-WAMRC_CMD = "../../wamr-compiler/build/wamrc"
-
-def compile_wasm_files_to_aot(wasm_apps_dir):
- wasm_files = glob.glob(wasm_apps_dir + "/*.wasm")
- print("Compile wasm app into aot files")
- for wasm_file in wasm_files:
- aot_file = wasm_file[0 : len(wasm_file) - 5] + ".aot";
- cmd = [ WAMRC_CMD, "-o", aot_file, wasm_file ]
- subprocess.check_call(cmd)
-
-def start_server(cmd, cwd):
- app_server = subprocess.Popen(shlex.split(cmd), cwd=cwd)
- return app_server
-
-def run_cmd(cmd, cwd):
- qry_prc = subprocess.run(
- shlex.split(cmd), cwd=cwd, check=False, capture_output=True
- )
- if (qry_prc.returncode != 0):
- print("Run {} failed, return {}".format(cmd), qry_prc.returncode)
- return
- print("return code: {}, output:\n{}".format(qry_prc.returncode,
- qry_prc.stdout.decode()))
-
-def main():
- """
- GO!GO!!GO!!!
- """
- parser = argparse.ArgumentParser(description="run the sample and examine outputs")
- parser.add_argument("working_directory", type=str)
- parser.add_argument("--aot", action='store_true', help="Test with AOT")
- args = parser.parse_args()
-
- test_aot = False
- suffix = ".wasm"
- if not args.aot:
- print("Test with interpreter mode")
- else:
- print("Test with AOT mode")
- test_aot = True
- suffix = ".aot"
- wasm_apps_dir = args.working_directory
- compile_wasm_files_to_aot(wasm_apps_dir)
-
- ret = 1
- app_server = None
- try:
- print("\n================================")
- print("Test TCP server and client")
- cmd = "./iwasm --addr-pool=0.0.0.0/15 tcp_server" + suffix
- app_server = start_server(cmd, args.working_directory)
- # wait for a second
- time.sleep(1)
- cmd = "./iwasm --addr-pool=127.0.0.1/15 tcp_client" + suffix
- for i in range(5):
- run_cmd(cmd, args.working_directory)
-
- print("\n================================")
- print("Test UDP server and client")
- cmd = "./iwasm --addr-pool=0.0.0.0/15 udp_server" + suffix
- app_server = start_server(cmd, args.working_directory)
- # wait for a second
- time.sleep(1)
- cmd = "./iwasm --addr-pool=127.0.0.1/15 udp_client" + suffix
- for i in range(5):
- run_cmd(cmd, args.working_directory)
-
- print("\n=====================================================")
- print("Sleep 80 seconds to wait TCP server port actually close")
- time.sleep(80)
-
- print("\n================================")
- print("Test send and receive")
- cmd = "./iwasm --addr-pool=127.0.0.1/0 ./send_recv" + suffix
- run_cmd(cmd, args.working_directory)
-
- print("\n================================")
- print("Test socket options")
- cmd = "./iwasm socket_opts" + suffix
- run_cmd(cmd, args.working_directory)
-
- print("\n================================")
- print("Test timeout server and client")
- cmd = "./iwasm --addr-pool=0.0.0.0/15 timeout_server" + suffix
- app_server = start_server(cmd, args.working_directory)
- # wait for a second
- time.sleep(1)
- cmd = "./iwasm --addr-pool=127.0.0.1/15 timeout_client" + suffix
- run_cmd(cmd, args.working_directory)
-
- print("\n==========================================")
- print("Test multicast_client and multicast_server")
- cmd = "./iwasm --addr-pool=0.0.0.0/0,::/0 multicast_client.wasm 224.0.0.1"
- app_server = start_server(cmd, args.working_directory)
- # wait for a second
- time.sleep(1)
- cmd = "./multicast_server 224.0.0.1"
- run_cmd(cmd, args.working_directory)
-
- cmd = "./iwasm --addr-pool=0.0.0.0/0,::/0 multicast_client.wasm FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2"
- app_server = start_server(cmd, args.working_directory)
- # wait for a second
- time.sleep(1)
- cmd = "./multicast_server FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2"
- run_cmd(cmd, args.working_directory)
-
- print("\n================================")
- print("Test address resolving")
- cmd = "./iwasm --allow-resolve=*.com addr_resolve.wasm github.com"
- cmd = "./multicast_server FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2"
- run_cmd(cmd, args.working_directory)
-
- # wait for a second
- time.sleep(1)
-
- print("--> All pass")
- ret = 0
- except AssertionError:
- traceback.print_exc()
- finally:
- app_server.kill()
-
- return ret
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/CMakeLists.txt
deleted file mode 100644
index 8f11e0a6b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 2.8...3.18)
-project(socket_api_sample_wasm_app)
-
-message(CHECK_START "Detecting WABT")
-if(NOT (DEFINED WABT_DIR OR DEFINED CACHE{WABT_DIR}))
- find_path(WABT_DIR
- wabt
- PATHS /opt
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
- )
- if(DEFINED WABT_DIR)
- set(WABT_DIR ${WABT_DIR}/wabt)
- endif()
-endif()
-if(WABT_DIR)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-message(CHECK_START "Detecting WASM_OBJDUMP at ${WABT_DIR}")
-find_program(WASM_OBJDUMP
- wasm-objdump
- PATHS "${WABT_DIR}/bin"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH
-)
-if(WASM_OBJDUMP)
- message(CHECK_PASS "found")
-else()
- message(CHECK_FAIL "not found")
-endif()
-
-set(SRC ${CMAKE_CURRENT_SOURCE_DIR})
-
-include(${CMAKE_CURRENT_SOURCE_DIR}/../../../core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake)
-
-function(COMPILE_WITH_CLANG SOURCE_FILE)
- get_filename_component(FILE_NAME ${SOURCE_FILE} NAME_WLE)
-
- set(WASM_MODULE ${FILE_NAME}.wasm)
-
- set(MAIN_TARGET_NAME MODULE_${FILE_NAME})
-
- add_executable(${MAIN_TARGET_NAME} ${SOURCE_FILE})
- set_target_properties(${MAIN_TARGET_NAME} PROPERTIES OUTPUT_NAME ${WASM_MODULE})
- target_include_directories(${MAIN_TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/inc)
- target_compile_options(${MAIN_TARGET_NAME} INTERFACE -pthread)
- target_link_libraries(${MAIN_TARGET_NAME} socket_wasi_ext)
- target_link_options(${MAIN_TARGET_NAME} PRIVATE
- LINKER:--export=__heap_base
- LINKER:--export=__data_end
- LINKER:--export=malloc
- LINKER:--export=free
- LINKER:--shared-memory,--max-memory=10485760
- LINKER:--no-check-features
- LINKER:--allow-undefined
- )
-
- if(EXISTS ${WASM_OBJDUMP})
- message(STATUS "Dumping ${WASM_MODULE}...")
- set(WASM_DUMP ${WASM_MODULE}.dump)
- set(DUMP_TARGET_NAME DUMP_${FILE_NAME})
-
- add_custom_command(OUTPUT ${WASM_DUMP}
- COMMAND ${WASM_OBJDUMP} -dx ${WASM_MODULE} > ${WASM_DUMP}
- COMMENT "Dumping ${WASM_MODULE}..."
- DEPENDS ${MAIN_TARGET_NAME}
- )
-
- add_custom_target(${DUMP_TARGET_NAME} ALL
- DEPENDS ${WASM_DUMP}
- )
- endif()
-endfunction()
-
-compile_with_clang(tcp_server.c)
-compile_with_clang(tcp_client.c)
-compile_with_clang(send_recv.c)
-compile_with_clang(addr_resolve.c)
-compile_with_clang(socket_opts.c)
-compile_with_clang(udp_client.c)
-compile_with_clang(udp_server.c)
-compile_with_clang(multicast_client.c)
-compile_with_clang(multicast_server.c)
-compile_with_clang(timeout_client.c)
-compile_with_clang(timeout_server.c)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/addr_resolve.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/addr_resolve.c
deleted file mode 100644
index 87734dea3..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/addr_resolve.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#else
-#include <netdb.h>
-#endif
-
-int
-lookup_host(const char *host)
-{
- struct addrinfo hints, *res, *result;
- int errcode;
- char addrstr[100];
- void *ptr;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
-
- errcode = getaddrinfo(host, NULL, &hints, &result);
- if (errcode != 0) {
- perror("getaddrinfo");
- return -1;
- }
-
- res = result;
-
- printf("Host: %s\n", host);
- while (res) {
- switch (res->ai_family) {
- case AF_INET:
- ptr = &((struct sockaddr_in *)res->ai_addr)->sin_addr;
- break;
- case AF_INET6:
- ptr = &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr;
- break;
- default:
- printf("Unsupported address family: %d\n", res->ai_family);
- continue;
- }
- inet_ntop(res->ai_family, ptr, addrstr, 100);
- printf("IPv%d address: %s (%s)\n", res->ai_family == AF_INET6 ? 6 : 4,
- addrstr, res->ai_socktype == SOCK_STREAM ? "TCP" : "UDP");
- res = res->ai_next;
- }
-
- freeaddrinfo(result);
-
- return EXIT_SUCCESS;
-}
-
-int
-main(int argc, char *argv[])
-{
- if (argc < 2) {
- printf("Usage: %s DOMAIN\n", argv[0]);
- return EXIT_FAILURE;
- }
-
- return lookup_host(argv[1]);
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/inc/.gitkeep b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/inc/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/inc/.gitkeep
+++ /dev/null
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_client.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_client.c
deleted file mode 100644
index 43201dcbd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_client.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-static void
-init_sockaddr_inet(struct sockaddr_in *addr)
-{
- addr->sin_family = AF_INET;
- addr->sin_port = htons(1234);
-}
-
-static void
-init_sockaddr_inet6(struct sockaddr_in6 *addr)
-{
- addr->sin6_family = AF_INET6;
- addr->sin6_port = htons(1234);
-}
-
-static int
-get_ip_addr_type(char *addr, char *buf)
-{
- if (inet_pton(AF_INET6, addr, buf)) {
- return AF_INET6;
- }
- if (inet_pton(AF_INET, addr, buf)) {
- return AF_INET;
- }
- return -1;
-}
-
-static int
-is_valid_addr_type(int addr_type)
-{
- return !(addr_type == -1
- || (addr_type != AF_INET && addr_type != AF_INET6));
-}
-
-int
-main(int argc, char *argv[])
-{
- struct ipv6_mreq ipv6_group;
- struct ip_mreq ipv4_group;
- int sd;
- int datalen;
- char databuf[1024] = { 0 };
- char multicast_addr_buffer[16];
- struct sockaddr_storage local_address = { 0 };
- int addr_type = -1;
- int read_result;
- int bool_opt = 1;
-
- if (argc < 2) {
- printf("Usage is <Multicast IP>\n");
- return EXIT_FAILURE;
- }
-
- addr_type = get_ip_addr_type(argv[1], multicast_addr_buffer);
-
- if (!is_valid_addr_type(addr_type)) {
- printf("Not a valid ipv4 or ipv6 address\n");
- return EXIT_FAILURE;
- }
-
- if ((sd = socket(addr_type, SOCK_DGRAM, 0)) == -1) {
- perror("Failed opening socket");
- return EXIT_FAILURE;
- }
-
- if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &bool_opt, sizeof(bool_opt))
- == -1) {
- perror("Failed setting SO_REUSEADDR");
- goto fail;
- }
-
- if (addr_type == AF_INET) {
- init_sockaddr_inet((struct sockaddr_in *)&local_address);
- memcpy(&(ipv4_group.imr_multiaddr), multicast_addr_buffer, 4);
- ipv4_group.imr_interface.s_addr = htonl(INADDR_ANY);
-
- if (setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &ipv4_group,
- sizeof(ipv4_group))
- == -1) {
- perror("Failed joining IPv4 multicast group");
- goto fail;
- }
- }
- else {
- init_sockaddr_inet6((struct sockaddr_in6 *)&local_address);
- memcpy(&(ipv6_group.ipv6mr_multiaddr), multicast_addr_buffer, 16);
- ipv6_group.ipv6mr_interface = 0;
-
- if (setsockopt(sd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &ipv6_group,
- sizeof(ipv6_group))
- == -1) {
- perror("Failed joining IPv6 multicast group");
- goto fail;
- }
- }
-
- if (bind(sd, (struct sockaddr *)&local_address, sizeof(local_address))
- == -1) {
- perror("Failed binding socket");
- goto fail;
- }
-
- printf("Joined multicast group. Waiting for datagram...\n");
-
- datalen = sizeof(databuf) - 1;
- read_result = read(sd, databuf, datalen);
-
- if (read_result < 0) {
- perror("Failed binding socket");
- goto fail;
- }
-
- printf("Reading datagram message...OK.\n");
- printf("The message from multicast server is: \"%s\"\n", databuf);
- close(sd);
- return EXIT_SUCCESS;
-
-fail:
- close(sd);
- return EXIT_FAILURE;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_server.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_server.c
deleted file mode 100644
index cd33557b2..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/multicast_server.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-static int
-get_ip_addr_type(char *addr, char *buf)
-{
- if (inet_pton(AF_INET6, addr, buf)) {
- return AF_INET6;
- }
- if (inet_pton(AF_INET, addr, buf)) {
- return AF_INET;
- }
- return -1;
-}
-
-static int
-is_valid_addr_type(int addr_type)
-{
- return !(addr_type == -1
- || (addr_type != AF_INET && addr_type != AF_INET6));
-}
-
-static void
-init_sockaddr_inet(struct sockaddr_in *addr, char *addr_buffer)
-{
- addr->sin_family = AF_INET;
- addr->sin_port = htons(1234);
- memcpy(&(addr->sin_addr), addr_buffer, 4);
-}
-
-static void
-init_sockaddr_inet6(struct sockaddr_in6 *addr, char *addr_buffer)
-{
- addr->sin6_family = AF_INET6;
- addr->sin6_port = htons(1234);
- memcpy(&(addr->sin6_addr), addr_buffer, 16);
-}
-
-int
-main(int argc, char *argv[])
-{
- struct sockaddr_storage addr = { 0 };
- int sd;
- char *databuf = "Test message";
- int datalen = strlen(databuf) + 1;
- char multicast_addr_buffer[16];
- int addr_type = -1;
- int multicast_interface;
- int bool_opt = 1;
-
- if (argc < 2) {
- printf("Usage is <Multicast IP>\n");
- return EXIT_FAILURE;
- }
-
- addr_type = get_ip_addr_type(argv[1], multicast_addr_buffer);
-
- if (!is_valid_addr_type(addr_type)) {
- printf("Not a valid ipv4 or ipv6 address\n");
- return EXIT_FAILURE;
- }
-
- if ((sd = socket(addr_type, SOCK_DGRAM, 0)) == -1) {
- return EXIT_FAILURE;
- }
-
- if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &bool_opt, sizeof(bool_opt))
- == -1) {
- perror("Failed setting SO_REUSEADDR");
- goto fail;
- }
-
- if (addr_type == AF_INET) {
- multicast_interface = htonl(INADDR_ANY);
- if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_IF,
- (char *)&multicast_interface,
- sizeof(multicast_interface))) {
- perror("Failed setting local interface");
- goto fail;
- }
- init_sockaddr_inet((struct sockaddr_in *)&addr, multicast_addr_buffer);
- }
- else {
- multicast_interface = 0;
- if (setsockopt(sd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
- (char *)&multicast_interface,
- sizeof(multicast_interface))) {
- perror("Failed setting local interface");
- goto fail;
- }
- init_sockaddr_inet6((struct sockaddr_in6 *)&addr,
- multicast_addr_buffer);
- }
-
- if (sendto(sd, databuf, datalen, 0, (struct sockaddr *)&addr, sizeof(addr))
- == -1) {
- perror("Failed sending datagram");
- goto fail;
- }
-
- printf("Datagram sent\n");
- close(sd);
- return EXIT_SUCCESS;
-
-fail:
- close(sd);
- return EXIT_FAILURE;
-} \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/send_recv.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/send_recv.c
deleted file mode 100644
index 0071b2a7b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/send_recv.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include <arpa/inet.h>
-#include <assert.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-static pthread_mutex_t lock = { 0 };
-static pthread_cond_t cond = { 0 };
-static bool server_create_failed = false;
-static bool server_is_ready = false;
-
-void *
-run_as_server(void *arg)
-{
- int sock = -1, on = 1;
- struct sockaddr_in addr = { 0 };
- int addrlen = 0;
- int new_sock = -1;
- char *buf[] = {
- "The stars shine down", "It brings us light", "Light comes down",
- "To make us paths", "It watches us", "And mourns for us",
- };
- struct iovec iov[] = {
- { .iov_base = buf[0], .iov_len = strlen(buf[0]) + 1 },
- { .iov_base = buf[1], .iov_len = strlen(buf[1]) + 1 },
- { .iov_base = buf[2], .iov_len = strlen(buf[2]) + 1 },
- { .iov_base = buf[3], .iov_len = strlen(buf[3]) + 1 },
- { .iov_base = buf[4], .iov_len = strlen(buf[4]) + 1 },
- { .iov_base = buf[5], .iov_len = strlen(buf[5]) + 1 },
- };
- struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 6 };
- ssize_t send_len = 0;
-
- pthread_mutex_lock(&lock);
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if (sock < 0) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Create a socket failed");
- return NULL;
- }
-
-#ifndef __wasi__
- if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on))) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Setsockopt failed");
- goto fail1;
- }
-#endif
-
- /* 0.0.0.0:1234 */
- addr.sin_family = AF_INET;
- addr.sin_port = htons(1234);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- addrlen = sizeof(addr);
- if (bind(sock, (struct sockaddr *)&addr, addrlen) < 0) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Bind failed");
- goto fail1;
- }
-
- if (listen(sock, 0) < 0) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Listen failed");
- goto fail1;
- }
-
- server_is_ready = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
-
- printf("Server is online ... \n");
-
- new_sock = accept(sock, (struct sockaddr *)&addr, (socklen_t *)&addrlen);
- if (new_sock < 0) {
- perror("Accept failed");
- goto fail1;
- }
-
- printf("Start sending. \n");
- send_len = sendmsg(new_sock, &msg, 0);
- if (send_len < 0) {
- perror("Sendmsg failed");
- goto fail2;
- }
- printf("Send %ld bytes successfully!\n", send_len);
-
-fail2:
- close(new_sock);
-fail1:
- shutdown(sock, SHUT_RD);
- close(sock);
- return NULL;
-}
-
-void *
-run_as_client(void *arg)
-{
- int sock = -1;
- struct sockaddr_in addr = { 0 };
- /* buf of server is 106 bytes */
- char buf[110] = { 0 };
- struct iovec iov = { .iov_base = buf, .iov_len = sizeof(buf) };
- struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1 };
- ssize_t recv_len = 0;
-
- pthread_mutex_lock(&lock);
- while (!server_create_failed && !server_is_ready) {
- pthread_cond_wait(&cond, &lock);
- }
- pthread_mutex_unlock(&lock);
-
- if (server_create_failed) {
- return NULL;
- }
-
- printf("Client is running...\n");
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if (sock < 0) {
- perror("Create a socket failed");
- return NULL;
- }
-
- /* 127.0.0.1:1234 */
- addr.sin_family = AF_INET;
- addr.sin_port = htons(1234);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- perror("Connect failed");
- goto fail;
- }
-
- printf("Start receiving. \n");
- recv_len = recvmsg(sock, &msg, 0);
- if (recv_len < 0) {
- perror("Recvmsg failed");
- goto fail;
- }
-
- printf("Receive %ld bytes successlly!\n", recv_len);
- assert(recv_len == 106);
-
- printf("Data:\n");
- char *s = msg.msg_iov->iov_base;
- while (strlen(s) > 0) {
- printf(" %s\n", s);
- s += strlen(s) + 1;
- }
-
-fail:
- shutdown(sock, SHUT_RD);
- close(sock);
- return NULL;
-}
-
-int
-main(int argc, char *argv[])
-{
- pthread_t cs[2] = { 0 };
- uint8_t i = 0;
- int ret = EXIT_SUCCESS;
-
- if (pthread_mutex_init(&lock, NULL)) {
- perror("Initialize mutex failed");
- ret = EXIT_FAILURE;
- goto RETURN;
- }
-
- if (pthread_cond_init(&cond, NULL)) {
- perror("Initialize condition failed");
- ret = EXIT_FAILURE;
- goto DESTROY_MUTEX;
- }
-
- if (pthread_create(&cs[0], NULL, run_as_server, NULL)) {
- perror("Create a server thread failed");
- ret = EXIT_FAILURE;
- goto DESTROY_COND;
- }
-
- if (pthread_create(&cs[1], NULL, run_as_client, NULL)) {
- perror("Create a client thread failed");
- ret = EXIT_FAILURE;
- goto DESTROY_COND;
- }
-
- for (i = 0; i < 2; i++) {
- pthread_join(cs[i], NULL);
- }
-
-DESTROY_COND:
- pthread_cond_destroy(&cond);
-DESTROY_MUTEX:
- pthread_mutex_destroy(&lock);
-RETURN:
- return ret;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_opts.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_opts.c
deleted file mode 100644
index 890cc0cc5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_opts.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <netinet/tcp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-#define MULTICAST_ADDR 16777440
-#define OPTION_ASSERT(A, B, OPTION) \
- if (A == B) { \
- printf("%s is expected\n", OPTION); \
- } \
- else { \
- printf("%s is unexpected\n", OPTION); \
- perror("assertion failed"); \
- return EXIT_FAILURE; \
- }
-
-static struct timeval
-to_timeval(time_t tv_sec, suseconds_t tv_usec)
-{
- struct timeval tv = { tv_sec, tv_usec };
- return tv;
-}
-
-static int
-set_and_get_bool_opt(int socket_fd, int level, int optname, int val)
-{
- int bool_opt = val;
- int ret = -1;
- socklen_t opt_len = sizeof(bool_opt);
-
- ret = setsockopt(socket_fd, level, optname, &bool_opt, sizeof(bool_opt));
- if (ret != 0)
- return !val;
-
- bool_opt = !bool_opt;
- ret = getsockopt(socket_fd, level, optname, &bool_opt, &opt_len);
- if (ret != 0)
- return !val;
-
- return bool_opt;
-}
-
-int
-main(int argc, char *argv[])
-{
- int tcp_socket_fd = 0;
- int udp_socket_fd = 0;
- int udp_ipv6_socket_fd = 0;
- struct timeval tv;
- socklen_t opt_len;
- int buf_len;
- int result;
- struct linger linger_opt;
- uint32_t time_s;
- int ttl;
-
- printf("[Client] Create TCP socket\n");
- tcp_socket_fd = socket(AF_INET, SOCK_STREAM, 0);
- if (tcp_socket_fd == -1) {
- perror("Create socket failed");
- return EXIT_FAILURE;
- }
-
- printf("[Client] Create UDP socket\n");
- udp_socket_fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (udp_socket_fd == -1) {
- perror("Create socket failed");
- return EXIT_FAILURE;
- }
-
- printf("[Client] Create UDP IPv6 socket\n");
- udp_ipv6_socket_fd = socket(AF_INET6, SOCK_DGRAM, 0);
- if (udp_ipv6_socket_fd == -1) {
- perror("Create socket failed");
- return EXIT_FAILURE;
- }
-
- // SO_RCVTIMEO
- tv = to_timeval(123, 1000);
- result =
- setsockopt(tcp_socket_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
- OPTION_ASSERT(result, 0, "setsockopt SO_RCVTIMEO result")
-
- tv = to_timeval(0, 0);
- opt_len = sizeof(tv);
- result = getsockopt(tcp_socket_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt SO_RCVTIMEO result")
- OPTION_ASSERT(tv.tv_sec, 123, "SO_RCVTIMEO tv_sec");
- // OPTION_ASSERT(tv.tv_usec, 1000, "SO_RCVTIMEO tv_usec");
-
- // SO_SNDTIMEO
- tv = to_timeval(456, 2000);
- result =
- setsockopt(tcp_socket_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
- OPTION_ASSERT(result, 0, "setsockopt SO_SNDTIMEO result")
-
- tv = to_timeval(0, 0);
- opt_len = sizeof(tv);
- result = getsockopt(tcp_socket_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt SO_SNDTIMEO result")
- OPTION_ASSERT(tv.tv_sec, 456, "SO_SNDTIMEO tv_sec");
- // OPTION_ASSERT(tv.tv_usec, 2000, "SO_SNDTIMEO tv_usec");
-
- // SO_SNDBUF
- buf_len = 8192;
- result = setsockopt(tcp_socket_fd, SOL_SOCKET, SO_SNDBUF, &buf_len,
- sizeof(buf_len));
- OPTION_ASSERT(result, 0, "setsockopt SO_SNDBUF result")
-
- buf_len = 0;
- opt_len = sizeof(buf_len);
- result =
- getsockopt(tcp_socket_fd, SOL_SOCKET, SO_SNDBUF, &buf_len, &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt SO_SNDBUF result")
- OPTION_ASSERT((buf_len == 16384 || buf_len == 8192), 1,
- "SO_SNDBUF buf_len");
-
- // SO_RCVBUF
- buf_len = 4096;
- result = setsockopt(tcp_socket_fd, SOL_SOCKET, SO_RCVBUF, &buf_len,
- sizeof(buf_len));
- OPTION_ASSERT(result, 0, "setsockopt SO_RCVBUF result")
-
- buf_len = 0;
- opt_len = sizeof(buf_len);
- result =
- getsockopt(tcp_socket_fd, SOL_SOCKET, SO_RCVBUF, &buf_len, &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt SO_RCVBUF result")
- OPTION_ASSERT((buf_len == 8192 || buf_len == 4096), 1, "SO_SNDBUF buf_len");
-
- // SO_KEEPALIVE
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, SOL_SOCKET, SO_KEEPALIVE, 1), 1,
- "SO_KEEPALIVE enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, SOL_SOCKET, SO_KEEPALIVE, 0), 0,
- "SO_KEEPALIVE disabled");
-
- // SO_REUSEADDR
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, SOL_SOCKET, SO_REUSEADDR, 1), 1,
- "SO_REUSEADDR enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, SOL_SOCKET, SO_REUSEADDR, 0), 0,
- "SO_REUSEADDR disabled");
-
- // SO_REUSEPORT
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, SOL_SOCKET, SO_REUSEPORT, 1), 1,
- "SO_REUSEPORT enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, SOL_SOCKET, SO_REUSEPORT, 0), 0,
- "SO_REUSEPORT disabled");
-
- // SO_LINGER
- linger_opt.l_onoff = 1;
- linger_opt.l_linger = 10;
- result = setsockopt(tcp_socket_fd, SOL_SOCKET, SO_LINGER, &linger_opt,
- sizeof(linger_opt));
- OPTION_ASSERT(result, 0, "setsockopt SO_LINGER result")
-
- linger_opt.l_onoff = 0;
- linger_opt.l_linger = 0;
- opt_len = sizeof(linger_opt);
- result =
- getsockopt(tcp_socket_fd, SOL_SOCKET, SO_LINGER, &linger_opt, &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt SO_LINGER result")
- OPTION_ASSERT(linger_opt.l_onoff, 1, "SO_LINGER l_onoff");
- OPTION_ASSERT(linger_opt.l_linger, 10, "SO_LINGER l_linger");
-
- // SO_BROADCAST
- OPTION_ASSERT(
- set_and_get_bool_opt(udp_socket_fd, SOL_SOCKET, SO_BROADCAST, 1), 1,
- "SO_BROADCAST enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(udp_socket_fd, SOL_SOCKET, SO_BROADCAST, 0), 0,
- "SO_BROADCAST disabled");
-
- // TCP_KEEPIDLE
-#ifdef TCP_KEEPIDLE
- time_s = 16;
- result = setsockopt(tcp_socket_fd, IPPROTO_TCP, TCP_KEEPIDLE, &time_s,
- sizeof(time_s));
- OPTION_ASSERT(result, 0, "setsockopt TCP_KEEPIDLE result")
-
- time_s = 0;
- opt_len = sizeof(time_s);
- result =
- getsockopt(tcp_socket_fd, IPPROTO_TCP, TCP_KEEPIDLE, &time_s, &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt TCP_KEEPIDLE result")
- OPTION_ASSERT(time_s, 16, "TCP_KEEPIDLE");
-#endif
-
- // TCP_KEEPINTVL
- time_s = 8;
- result = setsockopt(tcp_socket_fd, IPPROTO_TCP, TCP_KEEPINTVL, &time_s,
- sizeof(time_s));
- OPTION_ASSERT(result, 0, "setsockopt TCP_KEEPINTVL result")
-
- time_s = 0;
- opt_len = sizeof(time_s);
- result = getsockopt(tcp_socket_fd, IPPROTO_TCP, TCP_KEEPINTVL, &time_s,
- &opt_len);
- OPTION_ASSERT(result, 0, "getsockopt TCP_KEEPINTVL result")
- OPTION_ASSERT(time_s, 8, "TCP_KEEPINTVL");
-
- // TCP_FASTOPEN_CONNECT
-#ifdef TCP_FASTOPEN_CONNECT
- OPTION_ASSERT(set_and_get_bool_opt(tcp_socket_fd, IPPROTO_TCP,
- TCP_FASTOPEN_CONNECT, 1),
- 1, "TCP_FASTOPEN_CONNECT enabled");
- OPTION_ASSERT(set_and_get_bool_opt(tcp_socket_fd, IPPROTO_TCP,
- TCP_FASTOPEN_CONNECT, 0),
- 0, "TCP_FASTOPEN_CONNECT disabled");
-#endif
-
- // TCP_NODELAY
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, IPPROTO_TCP, TCP_NODELAY, 1), 1,
- "TCP_NODELAY enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, IPPROTO_TCP, TCP_NODELAY, 0), 0,
- "TCP_NODELAY disabled");
-
- // TCP_QUICKACK
-#ifdef TCP_QUICKACK
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, IPPROTO_TCP, TCP_QUICKACK, 1), 1,
- "TCP_QUICKACK enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(tcp_socket_fd, IPPROTO_TCP, TCP_QUICKACK, 0), 0,
- "TCP_QUICKACK disabled");
-#endif
-
- // IP_TTL
- ttl = 8;
- result = setsockopt(tcp_socket_fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
- OPTION_ASSERT(result, 0, "IP_TIL");
- ttl = 0;
- opt_len = sizeof(ttl);
- result = getsockopt(tcp_socket_fd, IPPROTO_IP, IP_TTL, &ttl, &opt_len);
- OPTION_ASSERT(ttl, 8, "IP_TTL");
- OPTION_ASSERT(result, 0, "IP_TIL");
-
- // IPV6_V6ONLY
- OPTION_ASSERT(
- set_and_get_bool_opt(udp_ipv6_socket_fd, IPPROTO_IPV6, IPV6_V6ONLY, 1),
- 1, "IPV6_V6ONLY enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(udp_ipv6_socket_fd, IPPROTO_IPV6, IPV6_V6ONLY, 0),
- 0, "IPV6_V6ONLY disabled");
-
- // IP_MULTICAST_LOOP
- OPTION_ASSERT(
- set_and_get_bool_opt(udp_socket_fd, IPPROTO_IP, IP_MULTICAST_LOOP, 1),
- 1, "IP_MULTICAST_LOOP enabled");
- OPTION_ASSERT(
- set_and_get_bool_opt(udp_socket_fd, IPPROTO_IP, IP_MULTICAST_LOOP, 0),
- 0, "IP_MULTICAST_LOOP disabled");
-
- // IP_MULTICAST_TTL
- ttl = 8;
- result = setsockopt(udp_socket_fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
- sizeof(ttl));
- OPTION_ASSERT(result, 0, "IP_MULTICAST_TTL");
- ttl = 0;
- opt_len = sizeof(ttl);
- result =
- getsockopt(udp_socket_fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, &opt_len);
- OPTION_ASSERT(ttl, 8, "IP_MULTICAST_TTL");
- OPTION_ASSERT(result, 0, "IP_MULTICAST_TTL");
-
- // IPV6_MULTICAST_LOOP
- OPTION_ASSERT(set_and_get_bool_opt(udp_ipv6_socket_fd, IPPROTO_IPV6,
- IPV6_MULTICAST_LOOP, 1),
- 1, "IPV6_MULTICAST_LOOP enabled");
- OPTION_ASSERT(set_and_get_bool_opt(udp_ipv6_socket_fd, IPPROTO_IPV6,
- IPV6_MULTICAST_LOOP, 0),
- 0, "IPV6_MULTICAST_LOOP disabled");
-
- printf("[Client] Close sockets\n");
- close(tcp_socket_fd);
- close(udp_socket_fd);
- close(udp_ipv6_socket_fd);
- return EXIT_SUCCESS;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_utils.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_utils.h
deleted file mode 100644
index b69135b79..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/socket_utils.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#ifndef TCP_UTILS_H
-#define TCP_UTILS_H
-
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-
-int
-sockaddr_to_string(struct sockaddr *addr, char *str, size_t len)
-{
- uint16_t port;
- char ip_string[64];
- void *addr_buf;
- int ret;
-
- switch (addr->sa_family) {
- case AF_INET:
- {
- struct sockaddr_in *addr_in = (struct sockaddr_in *)addr;
- port = addr_in->sin_port;
- addr_buf = &addr_in->sin_addr;
- break;
- }
- case AF_INET6:
- {
- struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr;
- port = addr_in6->sin6_port;
- addr_buf = &addr_in6->sin6_addr;
- break;
- }
- default:
- return -1;
- }
-
- inet_ntop(addr->sa_family, addr_buf, ip_string,
- sizeof(ip_string) / sizeof(ip_string[0]));
-
- ret = snprintf(str, len, "%s:%d", ip_string, ntohs(port));
-
- return ret > 0 && (size_t)ret < len ? 0 : -1;
-}
-
-#endif /* TCP_UTILS_H */ \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_client.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_client.c
deleted file mode 100644
index aad449483..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_client.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include "socket_utils.h"
-
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-static void
-init_sockaddr_inet(struct sockaddr_in *addr)
-{
- /* 127.0.0.1:1234 */
- addr->sin_family = AF_INET;
- addr->sin_port = htons(1234);
- addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-}
-
-static void
-init_sockaddr_inet6(struct sockaddr_in6 *addr)
-{
- /* [::1]:1234 */
- addr->sin6_family = AF_INET6;
- addr->sin6_port = htons(1234);
- addr->sin6_addr = in6addr_loopback;
-}
-
-int
-main(int argc, char *argv[])
-{
- int socket_fd, ret, total_size = 0, af;
- char buffer[1024] = { 0 };
- char ip_string[64] = { 0 };
- socklen_t len;
- struct sockaddr_storage server_address = { 0 };
- struct sockaddr_storage local_address = { 0 };
-
- if (argc > 1 && strcmp(argv[1], "inet6") == 0) {
- af = AF_INET6;
- len = sizeof(struct sockaddr_in6);
- init_sockaddr_inet6((struct sockaddr_in6 *)&server_address);
- }
- else {
- af = AF_INET;
- len = sizeof(struct sockaddr_in);
- init_sockaddr_inet((struct sockaddr_in *)&server_address);
- }
-
- printf("[Client] Create socket\n");
- socket_fd = socket(af, SOCK_STREAM, 0);
- if (socket_fd == -1) {
- perror("Create socket failed");
- return EXIT_FAILURE;
- }
-
- printf("[Client] Connect socket\n");
- if (connect(socket_fd, (struct sockaddr *)&server_address, len) == -1) {
- perror("Connect failed");
- close(socket_fd);
- return EXIT_FAILURE;
- }
-
- len = sizeof(local_address);
- ret = getsockname(socket_fd, (struct sockaddr *)&local_address, &len);
- if (ret == -1) {
- perror("Failed to retrieve socket address");
- close(socket_fd);
- return EXIT_FAILURE;
- }
-
- if (sockaddr_to_string((struct sockaddr *)&local_address, ip_string,
- sizeof(ip_string) / sizeof(ip_string[0]))
- != 0) {
- printf("[Client] failed to parse local address\n");
- close(socket_fd);
- return EXIT_FAILURE;
- }
-
- printf("[Client] Local address is: %s\n", ip_string);
-
- printf("[Client] Client receive\n");
- while (1) {
- ret = recv(socket_fd, buffer + total_size, sizeof(buffer) - total_size,
- 0);
- if (ret <= 0)
- break;
- total_size += ret;
- }
-
- printf("[Client] %d bytes received:\n", total_size);
- if (total_size > 0) {
- printf("Buffer recieved:\n%s\n", buffer);
- }
-
- close(socket_fd);
- printf("[Client] BYE \n");
- return EXIT_SUCCESS;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_server.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_server.c
deleted file mode 100644
index 2798dc252..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/tcp_server.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#include "socket_utils.h"
-
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-#define WORKER_NUM 5
-
-void *
-run(void *arg)
-{
- const char *message = "Say Hi from the Server\n";
- int new_socket = *(int *)arg;
- int i;
-
- printf("[Server] Communicate with the new connection #%u @ %p ..\n",
- new_socket, (void *)(uintptr_t)pthread_self());
-
- for (i = 0; i < 5; i++) {
- if (send(new_socket, message, strlen(message), 0) < 0) {
- perror("Send failed");
- break;
- }
- }
-
- printf("[Server] Shuting down the new connection #%u ..\n", new_socket);
- shutdown(new_socket, SHUT_RDWR);
-
- return NULL;
-}
-
-static void
-init_sockaddr_inet(struct sockaddr_in *addr)
-{
- /* 0.0.0.0:1234 */
- addr->sin_family = AF_INET;
- addr->sin_port = htons(1234);
- addr->sin_addr.s_addr = htonl(INADDR_ANY);
-}
-
-static void
-init_sockaddr_inet6(struct sockaddr_in6 *addr)
-{
- /* [::]:1234 */
- addr->sin6_family = AF_INET6;
- addr->sin6_port = htons(1234);
- addr->sin6_addr = in6addr_any;
-}
-
-int
-main(int argc, char *argv[])
-{
- int socket_fd = -1, addrlen = 0, af;
- struct sockaddr_storage addr = { 0 };
- unsigned connections = 0;
- pthread_t workers[WORKER_NUM] = { 0 };
- int client_sock_fds[WORKER_NUM] = { 0 };
- char ip_string[64];
-
- if (argc > 1 && strcmp(argv[1], "inet6") == 0) {
- af = AF_INET6;
- addrlen = sizeof(struct sockaddr_in6);
- init_sockaddr_inet6((struct sockaddr_in6 *)&addr);
- }
- else {
- af = AF_INET;
- addrlen = sizeof(struct sockaddr_in6);
- init_sockaddr_inet((struct sockaddr_in *)&addr);
- }
-
- printf("[Server] Create socket\n");
- socket_fd = socket(af, SOCK_STREAM, 0);
- if (socket_fd < 0) {
- perror("Create socket failed");
- goto fail;
- }
-
- printf("[Server] Bind socket\n");
- if (bind(socket_fd, (struct sockaddr *)&addr, addrlen) < 0) {
- perror("Bind failed");
- goto fail;
- }
-
- printf("[Server] Listening on socket\n");
- if (listen(socket_fd, 3) < 0) {
- perror("Listen failed");
- goto fail;
- }
-
- printf("[Server] Wait for clients to connect ..\n");
- while (connections < WORKER_NUM) {
- addrlen = sizeof(struct sockaddr);
- client_sock_fds[connections] =
- accept(socket_fd, (struct sockaddr *)&addr, (socklen_t *)&addrlen);
- if (client_sock_fds[connections] < 0) {
- perror("Accept failed");
- break;
- }
-
- if (sockaddr_to_string((struct sockaddr *)&addr, ip_string,
- sizeof(ip_string) / sizeof(ip_string[0]))
- != 0) {
- printf("[Server] failed to parse client address\n");
- goto fail;
- }
-
- printf("[Server] Client connected (%s)\n", ip_string);
- if (pthread_create(&workers[connections], NULL, run,
- &client_sock_fds[connections])) {
- perror("Create a worker thread failed");
- shutdown(client_sock_fds[connections], SHUT_RDWR);
- break;
- }
-
- connections++;
- }
-
- if (connections == WORKER_NUM) {
- printf("[Server] Achieve maximum amount of connections\n");
- }
-
- for (int i = 0; i < WORKER_NUM; i++) {
- pthread_join(workers[i], NULL);
- }
-
- printf("[Server] Shuting down ..\n");
- shutdown(socket_fd, SHUT_RDWR);
- sleep(3);
- printf("[Server] BYE \n");
- return EXIT_SUCCESS;
-
-fail:
- printf("[Server] Shuting down ..\n");
- if (socket_fd >= 0)
- close(socket_fd);
- sleep(3);
- return EXIT_FAILURE;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_client.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_client.c
deleted file mode 100644
index 652021b5d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_client.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-int
-main(int argc, char *argv[])
-{
- int socket_fd;
- struct sockaddr_in addr;
- struct timeval tv = { 0, 1 };
- const int snd_buf_len = 8;
- const int data_buf_len = 1000000;
- char *buffer = (char *)malloc(sizeof(char) * data_buf_len);
- int result;
- socklen_t opt_len = sizeof(snd_buf_len);
- struct timeval snd_start_time, snd_end_time;
- int bool_opt = 1;
-
- if (buffer == NULL) {
- perror("Allocation failed, please re-run with larger heap size");
- return EXIT_FAILURE;
- }
-
- /* 127.0.0.1:1234 */
- addr.sin_family = AF_INET;
- addr.sin_port = htons(1234);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- if ((socket_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
- perror("Create socket failed");
- goto fail1;
- }
-
- if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &bool_opt,
- sizeof(bool_opt))
- == -1) {
- perror("Failed setting SO_REUSEADDR");
- goto fail2;
- }
-
- if (setsockopt(socket_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) {
- perror("Failed setting SO_RCVTIMEO");
- goto fail2;
- }
-
- if (setsockopt(socket_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) {
- perror("Failed setting SO_SNDTIMEO");
- goto fail2;
- }
-
- if (setsockopt(socket_fd, SOL_SOCKET, SO_SNDBUF, &data_buf_len,
- sizeof(data_buf_len))
- == -1) {
- perror("Failed setting SO_SNDBUF");
- goto fail2;
- }
-
- if (connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- perror("Connect failed");
- goto fail2;
- }
-
- if (getsockopt(socket_fd, SOL_SOCKET, SO_SNDBUF, (void *)&data_buf_len,
- &opt_len)
- == -1) {
- perror("Failed getting SO_SNDBUF");
- goto fail2;
- }
-
- printf("Waiting on recv, which should timeout\n");
- result = recv(socket_fd, buffer, 1, 0);
-
- if (result != -1 || errno != EAGAIN) {
- perror("Recv did not timeout as expected");
- goto fail2;
- }
-
- printf("Waiting on send, which should timeout\n");
- gettimeofday(&snd_start_time, NULL);
- result = send(socket_fd, buffer, data_buf_len, 0);
- gettimeofday(&snd_end_time, NULL);
-
- if (result >= data_buf_len
- || snd_start_time.tv_sec != snd_end_time.tv_sec) {
- perror("Send did not timeout as expected");
- goto fail2;
- }
-
- printf("Success. Closing socket \n");
- close(socket_fd);
- free(buffer);
- return EXIT_SUCCESS;
-
-fail2:
- close(socket_fd);
-fail1:
- free(buffer);
- return EXIT_FAILURE;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_server.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_server.c
deleted file mode 100644
index c71cf4553..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/timeout_server.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-int
-main(int argc, char *argv[])
-{
- int socket_fd;
- int client_socket_fd;
- struct sockaddr_in addr = { 0 };
- int addrlen = sizeof(addr);
- int bool_opt = 1;
-
- addr.sin_family = AF_INET;
- addr.sin_port = htons(1234);
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
- if ((socket_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
- perror("Create socket failed");
- return EXIT_FAILURE;
- }
-
- if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &bool_opt,
- sizeof(bool_opt))
- == -1) {
- perror("Failed setting SO_REUSEADDR");
- goto fail;
- }
-
- if (bind(socket_fd, (struct sockaddr *)&addr, addrlen) == -1) {
- perror("Bind socket failed");
- goto fail;
- }
-
- if (listen(socket_fd, 1) == -1) {
- perror("Listen failed");
- goto fail;
- }
-
- if ((client_socket_fd =
- accept(socket_fd, (struct sockaddr *)&addr, (socklen_t *)&addrlen))
- == -1) {
- perror("Accept failed");
- goto fail;
- }
-
- printf("Client connected, sleeping for 10s\n");
- sleep(10);
-
- printf("Shuting down\n");
- shutdown(client_socket_fd, SHUT_RDWR);
- close(client_socket_fd);
- shutdown(socket_fd, SHUT_RDWR);
- close(socket_fd);
- return EXIT_SUCCESS;
-
-fail:
- close(socket_fd);
- return EXIT_FAILURE;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_client.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_client.c
deleted file mode 100644
index 810a455f8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_client.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-static void
-init_sockaddr_inet(struct sockaddr_in *addr)
-{
- /* 127.0.0.1:1234 */
- addr->sin_family = AF_INET;
- addr->sin_port = htons(1234);
- addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-}
-
-static void
-init_sockaddr_inet6(struct sockaddr_in6 *addr)
-{
- /* [::1]:1234 */
- addr->sin6_family = AF_INET6;
- addr->sin6_port = htons(1234);
- addr->sin6_addr = in6addr_loopback;
-}
-
-int
-main(int argc, char *argv[])
-{
- int socket_fd, ret, af;
- char buffer[1024] = { 0 };
- socklen_t serverlen;
- struct sockaddr_storage server_address = { 0 };
- const char *message = "Hello from client";
-
- if (argc > 1 && strcmp(argv[1], "inet6") == 0) {
- af = AF_INET6;
- init_sockaddr_inet6((struct sockaddr_in6 *)&server_address);
- serverlen = sizeof(struct sockaddr_in6);
- }
- else {
- af = AF_INET;
- init_sockaddr_inet((struct sockaddr_in *)&server_address);
- serverlen = sizeof(struct sockaddr_in);
- }
-
- printf("[Client] Create socket\n");
- socket_fd = socket(af, SOCK_DGRAM, 0);
- if (socket_fd == -1) {
- perror("Create socket failed");
- return EXIT_FAILURE;
- }
-
- printf("[Client] Client send\n");
- ret = sendto(socket_fd, message, strlen(message), 0,
- (struct sockaddr *)&server_address, serverlen);
- if (ret < 0) {
- close(socket_fd);
- perror("Send failed");
- return EXIT_FAILURE;
- }
-
- printf("[Client] Client receive\n");
- serverlen = sizeof(server_address);
- /* make sure there is space for the string terminator */
- ret = recvfrom(socket_fd, buffer, sizeof(buffer) - 1, 0,
- (struct sockaddr *)&server_address, &serverlen);
-
- if (ret > 0) {
- buffer[ret] = '\0';
- printf("[Client] Buffer recieved: %s\n", buffer);
- }
-
- close(socket_fd);
- printf("[Client] BYE \n");
- return EXIT_SUCCESS;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_server.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_server.c
deleted file mode 100644
index 588964145..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/socket-api/wasm-src/udp_server.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "socket_utils.h"
-
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#endif
-
-#define MAX_CONNECTIONS_COUNT 5
-
-static void
-init_sockaddr_inet(struct sockaddr_in *addr)
-{
- /* 0.0.0.0:1234 */
- addr->sin_family = AF_INET;
- addr->sin_port = htons(1234);
- addr->sin_addr.s_addr = htonl(INADDR_ANY);
-}
-
-static void
-init_sockaddr_inet6(struct sockaddr_in6 *addr)
-{
- /* [::]:1234 */
- addr->sin6_family = AF_INET6;
- addr->sin6_port = htons(1234);
- addr->sin6_addr = in6addr_any;
-}
-
-int
-main(int argc, char *argv[])
-{
- int socket_fd = -1, af;
- socklen_t addrlen = 0;
- struct sockaddr_storage addr = { 0 };
- char *reply_message = "Hello from server";
- unsigned connections = 0;
- char ip_string[64] = { 0 };
- char buffer[1024] = { 0 };
-
- if (argc > 1 && strcmp(argv[1], "inet6") == 0) {
- af = AF_INET6;
- addrlen = sizeof(struct sockaddr_in6);
- init_sockaddr_inet6((struct sockaddr_in6 *)&addr);
- }
- else {
- af = AF_INET;
- addrlen = sizeof(struct sockaddr_in);
- init_sockaddr_inet((struct sockaddr_in *)&addr);
- }
-
- printf("[Server] Create socket\n");
- socket_fd = socket(af, SOCK_DGRAM, 0);
- if (socket_fd < 0) {
- perror("Create socket failed");
- goto fail;
- }
-
- printf("[Server] Bind socket\n");
- if (bind(socket_fd, (struct sockaddr *)&addr, addrlen) < 0) {
- perror("Bind failed");
- goto fail;
- }
-
- printf("[Server] Wait for clients to connect ..\n");
- while (connections < MAX_CONNECTIONS_COUNT) {
- addrlen = sizeof(addr);
- /* make sure there is space for the string terminator */
- int ret = recvfrom(socket_fd, buffer, sizeof(buffer) - 1, 0,
- (struct sockaddr *)&addr, &addrlen);
- if (ret < 0) {
- perror("Read failed");
- goto fail;
- }
- buffer[ret] = '\0';
-
- if (sockaddr_to_string((struct sockaddr *)&addr, ip_string,
- sizeof(ip_string) / sizeof(ip_string[0]))
- != 0) {
- printf("[Server] failed to parse client address\n");
- goto fail;
- }
-
- printf("[Server] received %d bytes from %s: %s\n", ret, ip_string,
- buffer);
-
- if (sendto(socket_fd, reply_message, strlen(reply_message), 0,
- (struct sockaddr *)&addr, addrlen)
- < 0) {
- perror("Send failed");
- break;
- }
-
- connections++;
- }
-
- if (connections == MAX_CONNECTIONS_COUNT) {
- printf("[Server] Achieve maximum amount of connections\n");
- }
-
- printf("[Server] Shuting down ..\n");
- shutdown(socket_fd, SHUT_RDWR);
- close(socket_fd);
- sleep(3);
- printf("[Server] BYE \n");
- return EXIT_SUCCESS;
-
-fail:
- printf("[Server] Shuting down ..\n");
- if (socket_fd >= 0)
- close(socket_fd);
- sleep(3);
- return EXIT_FAILURE;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/CMakeLists.txt
deleted file mode 100644
index 7b76311d7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/CMakeLists.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-
-include(CheckPIESupported)
-
-project(spawn_thread)
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Resetdefault linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set(WAMR_BUILD_INTERP 1)
-set(WAMR_BUILD_AOT 1)
-set(WAMR_BUILD_JIT 0)
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_FAST_INTERP 1)
-set(WAMR_BUILD_LIB_PTHREAD 1)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-################################################
-
-
-################ wasm application ################
-add_subdirectory(wasm-apps)
-
-################ wamr runtime ################
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-set (RUNTIME_SOURCE_ALL
- ${CMAKE_CURRENT_LIST_DIR}/src/main.c
- ${UNCOMMON_SHARED_SOURCE}
-)
-add_executable (spawn_thread ${RUNTIME_SOURCE_ALL})
-check_pie_supported()
-set_target_properties (spawn_thread PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_link_libraries(spawn_thread vmlib -lpthread -lm)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/src/main.c
deleted file mode 100644
index 9501ae4c0..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/src/main.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_export.h"
-#include "bh_read_file.h"
-#include "pthread.h"
-
-#define THREAD_NUM 10
-
-typedef struct ThreadArgs {
- wasm_exec_env_t exec_env;
- int start;
- int length;
-} ThreadArgs;
-
-void *
-thread(void *arg)
-{
- ThreadArgs *thread_arg = (ThreadArgs *)arg;
- wasm_exec_env_t exec_env = thread_arg->exec_env;
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- wasm_function_inst_t func;
- uint32 argv[2];
-
- if (!wasm_runtime_init_thread_env()) {
- printf("failed to initialize thread environment");
- return NULL;
- }
-
- func = wasm_runtime_lookup_function(module_inst, "sum", NULL);
- if (!func) {
- printf("failed to lookup function sum");
- wasm_runtime_destroy_thread_env();
- return NULL;
- }
- argv[0] = thread_arg->start;
- argv[1] = thread_arg->length;
-
- /* call the WASM function */
- if (!wasm_runtime_call_wasm(exec_env, func, 2, argv)) {
- printf("%s\n", wasm_runtime_get_exception(module_inst));
- wasm_runtime_destroy_thread_env();
- return NULL;
- }
-
- wasm_runtime_destroy_thread_env();
- return (void *)(uintptr_t)argv[0];
-}
-
-void *
-wamr_thread_cb(wasm_exec_env_t exec_env, void *arg)
-{
- ThreadArgs *thread_arg = (ThreadArgs *)arg;
- wasm_module_inst_t module_inst = get_module_inst(exec_env);
- wasm_function_inst_t func;
- uint32 argv[2];
-
- func = wasm_runtime_lookup_function(module_inst, "sum", NULL);
- if (!func) {
- printf("failed to lookup function sum");
- return NULL;
- }
- argv[0] = thread_arg->start;
- argv[1] = thread_arg->length;
-
- /* call the WASM function */
- if (!wasm_runtime_call_wasm(exec_env, func, 2, argv)) {
- printf("%s\n", wasm_runtime_get_exception(module_inst));
- return NULL;
- }
-
- return (void *)(uintptr_t)argv[0];
-}
-
-int
-main(int argc, char *argv[])
-{
- char *wasm_file = "wasm-apps/test.wasm";
- uint8 *wasm_file_buf = NULL;
- uint32 wasm_file_size, wasm_argv[2], i, threads_created;
- uint32 stack_size = 16 * 1024, heap_size = 16 * 1024;
- wasm_module_t wasm_module = NULL;
- wasm_module_inst_t wasm_module_inst = NULL;
- wasm_exec_env_t exec_env = NULL;
- RuntimeInitArgs init_args;
- ThreadArgs thread_arg[THREAD_NUM];
- pthread_t tid[THREAD_NUM];
- wasm_thread_t wasm_tid[THREAD_NUM];
- uint32 result[THREAD_NUM], sum;
- wasm_function_inst_t func;
- char error_buf[128] = { 0 };
-
- memset(thread_arg, 0, sizeof(ThreadArgs) * THREAD_NUM);
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
- init_args.mem_alloc_type = Alloc_With_Allocator;
- init_args.mem_alloc_option.allocator.malloc_func = malloc;
- init_args.mem_alloc_option.allocator.realloc_func = realloc;
- init_args.mem_alloc_option.allocator.free_func = free;
- init_args.max_thread_num = THREAD_NUM;
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- /* load WASM byte buffer from WASM bin file */
- if (!(wasm_file_buf =
- (uint8 *)bh_read_file_to_buffer(wasm_file, &wasm_file_size)))
- goto fail1;
-
- /* load WASM module */
- if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size,
- error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto fail2;
- }
-
- /* instantiate the module */
- if (!(wasm_module_inst =
- wasm_runtime_instantiate(wasm_module, stack_size, heap_size,
- error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto fail3;
- }
-
- /* Create the first exec_env */
- if (!(exec_env =
- wasm_runtime_create_exec_env(wasm_module_inst, stack_size))) {
- printf("failed to create exec_env\n");
- goto fail4;
- }
-
- func = wasm_runtime_lookup_function(wasm_module_inst, "sum", NULL);
- if (!func) {
- printf("failed to lookup function sum");
- goto fail5;
- }
- wasm_argv[0] = 0;
- wasm_argv[1] = THREAD_NUM * 10;
-
- /*
- * Execute the wasm function in current thread, get the expect result
- */
- if (!wasm_runtime_call_wasm(exec_env, func, 2, wasm_argv)) {
- printf("%s\n", wasm_runtime_get_exception(wasm_module_inst));
- }
- printf("expect result: %d\n", wasm_argv[0]);
-
- /*
- * Run wasm function in multiple thread created by pthread_create
- */
- memset(thread_arg, 0, sizeof(ThreadArgs) * THREAD_NUM);
- for (i = 0; i < THREAD_NUM; i++) {
- wasm_exec_env_t new_exec_env;
- thread_arg[i].start = 10 * i;
- thread_arg[i].length = 10;
-
- /* spawn a new exec_env to be executed in other threads */
- new_exec_env = wasm_runtime_spawn_exec_env(exec_env);
- if (new_exec_env)
- thread_arg[i].exec_env = new_exec_env;
- else {
- printf("failed to spawn exec_env\n");
- break;
- }
-
- /* If we use:
- thread_arg[i].exec_env = exec_env,
- we may get wrong result */
-
- if (0 != pthread_create(&tid[i], NULL, thread, &thread_arg[i])) {
- printf("failed to create thread.\n");
- wasm_runtime_destroy_spawned_exec_env(new_exec_env);
- break;
- }
- }
-
- threads_created = i;
-
- sum = 0;
- memset(result, 0, sizeof(uint32) * THREAD_NUM);
- for (i = 0; i < threads_created; i++) {
- pthread_join(tid[i], (void **)&result[i]);
- sum += result[i];
- /* destroy the spawned exec_env */
- if (thread_arg[i].exec_env)
- wasm_runtime_destroy_spawned_exec_env(thread_arg[i].exec_env);
- }
-
- printf("[pthread]sum result: %d\n", sum);
-
- /*
- * Run wasm function in multiple thread created by wamr spawn API
- */
- memset(thread_arg, 0, sizeof(ThreadArgs) * THREAD_NUM);
- for (i = 0; i < THREAD_NUM; i++) {
- thread_arg[i].start = 10 * i;
- thread_arg[i].length = 10;
-
- /* No need to spawn exec_env manually */
- if (0
- != wasm_runtime_spawn_thread(exec_env, &wasm_tid[i], wamr_thread_cb,
- &thread_arg[i])) {
- printf("failed to spawn thread.\n");
- break;
- }
- }
-
- threads_created = i;
-
- sum = 0;
- memset(result, 0, sizeof(uint32) * THREAD_NUM);
- for (i = 0; i < threads_created; i++) {
- wasm_runtime_join_thread(wasm_tid[i], (void **)&result[i]);
- sum += result[i];
- /* No need to destroy the spawned exec_env */
- }
- printf("[spwan_thread]sum result: %d\n", sum);
-
-fail5:
- wasm_runtime_destroy_exec_env(exec_env);
-
-fail4:
- /* destroy the module instance */
- wasm_runtime_deinstantiate(wasm_module_inst);
-
-fail3:
- /* unload the module */
- wasm_runtime_unload(wasm_module);
-
-fail2:
- /* free the file buffer */
- wasm_runtime_free(wasm_file_buf);
-
-fail1:
- /* destroy runtime environment */
- wasm_runtime_destroy();
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/CMakeLists.txt
deleted file mode 100644
index 52ee7d752..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 2.8)
-project(wasm-apps)
-
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
-
-if (APPLE)
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
- set (CMAKE_C_LINK_FLAGS "")
- set (CMAKE_CXX_LINK_FLAGS "")
-endif ()
-set(CMAKE_SYSTEM_PROCESSOR wasm32)
-set (CMAKE_SYSROOT ${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot)
-
-if (NOT DEFINED WASI_SDK_DIR)
- set (WASI_SDK_DIR "/opt/wasi-sdk")
-endif ()
-
-set (CMAKE_C_FLAGS "-nostdlib -pthread -Qunused-arguments")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -z stack-size=32768")
-set (CMAKE_C_COMPILER_TARGET "wasm32")
-set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
-
-set (DEFINED_SYMBOLS
-"${WAMR_ROOT_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt")
-
-set (CMAKE_EXE_LINKER_FLAGS
- "-Wl,--shared-memory,--max-memory=131072, \
- -Wl,--no-entry,--strip-all,--export=sum, \
- -Wl,--export=__heap_base,--export=__data_end \
- -Wl,--export=__wasm_call_ctors \
- -Wl,--allow-undefined-file=${DEFINED_SYMBOLS}"
-)
-
-add_executable(test.wasm sum.c)
-target_link_libraries(test.wasm)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/sum.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/sum.c
deleted file mode 100644
index 0bcb8918d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/spawn-thread/wasm-apps/sum.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-int
-sum(int start, int length)
-{
- int sum = 0, i;
-
- for (i = start; i < start + length; i++) {
- sum += i;
- }
-
- return sum;
-} \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/CMakeLists.txt
deleted file mode 100644
index 467f5fd1f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/CMakeLists.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-
-include(CheckPIESupported)
-
-project(wasi_threads_sample)
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Resetdefault linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set(WAMR_BUILD_INTERP 1)
-set(WAMR_BUILD_AOT 1)
-set(WAMR_BUILD_JIT 0)
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_FAST_INTERP 1)
-set(WAMR_BUILD_LIBC_WASI 1)
-set(WAMR_BUILD_LIB_WASI_THREADS 1)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-################################################
-
-
-################ wasm application ################
-add_subdirectory(wasm-apps)
-
-################ wamr runtime ################
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-set (RUNTIME_SOURCE_ALL
- ${CMAKE_CURRENT_LIST_DIR}/../../product-mini/platforms/linux/main.c
- ${UNCOMMON_SHARED_SOURCE}
-)
-add_executable (iwasm ${RUNTIME_SOURCE_ALL})
-check_pie_supported()
-set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_link_libraries(iwasm vmlib -lpthread -lm -ldl)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/README.md
deleted file mode 100644
index a79a3cd6a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# "WASI threads" sample introduction
-
-To run the sample, `wasi-sdk` >= 20 is required.
-
-## Build and run the samples
-
-```shell
-$ mkdir build
-$ cd build
-$ cmake ..
-$ make
-...
-$ ./iwasm wasm-apps/no_pthread.wasm
-```
-
-## Run samples in AOT mode
-```shell
-$ ../../../wamr-compiler/build/wamrc \
- --enable-multi-thread \
- -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
-$ ./iwasm wasm-apps/no_pthread.aot
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/CMakeLists.txt
deleted file mode 100644
index 87f21e9fd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-if (APPLE)
- set (HAVE_FLAG_SEARCH_PATHS_FIRST 0)
- set (CMAKE_C_LINK_FLAGS "")
- set (CMAKE_CXX_LINK_FLAGS "")
-endif ()
-
-if (NOT DEFINED WASI_SDK_DIR)
- set (WASI_SDK_DIR "/opt/wasi-sdk")
-endif ()
-
-if (DEFINED WASI_SYSROOT)
- set (CMAKE_SYSROOT "${WASI_SYSROOT}")
-endif ()
-
-set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
-set (CMAKE_ASM_COMPILER "${WASI_SDK_DIR}/bin/clang")
-set (CMAKE_EXE_LINKER_FLAGS "-target wasm32-wasi-threads")
-
-if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1)
- set (CMAKE_C_FLAGS "")
- set (CMAKE_CXX_FLAGS "")
-endif ()
-
-function (compile_sample SOURCE_FILE)
- get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE)
- set (WASM_MODULE ${FILE_NAME}.wasm)
- add_executable (${WASM_MODULE} ${SOURCE_FILE} ${ARGN})
-
- target_compile_options (${WASM_MODULE} PRIVATE
- -pthread -ftls-model=local-exec)
-
- target_link_options (${WASM_MODULE} PRIVATE
- -z stack-size=32768
- LINKER:--export=__heap_base
- LINKER:--export=__data_end
- LINKER:--shared-memory,--max-memory=1966080
- LINKER:--export=wasi_thread_start
- LINKER:--export=malloc
- LINKER:--export=free
- )
-endfunction ()
-
-compile_sample(no_pthread.c wasi_thread_start.S) \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/no_pthread.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/no_pthread.c
deleted file mode 100644
index dc3c95530..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/no_pthread.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef __wasi__
-#error This example only compiles to WASM/WASI target
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include "wasi_thread_start.h"
-
-static const int64_t SECOND = 1000 * 1000 * 1000;
-
-typedef struct {
- start_args_t base;
- int th_ready;
- int value;
- int thread_id;
-} shared_t;
-
-void
-__wasi_thread_start_C(int thread_id, int *start_arg)
-{
- shared_t *data = (shared_t *)start_arg;
-
- printf("New thread ID: %d, starting parameter: %d\n", thread_id,
- data->value);
-
- data->thread_id = thread_id;
- data->value += 8;
- printf("Updated value: %d\n", data->value);
-
- __atomic_store_n(&data->th_ready, 1, __ATOMIC_SEQ_CST);
- __builtin_wasm_memory_atomic_notify(&data->th_ready, 1);
-}
-
-int
-main(int argc, char **argv)
-{
- shared_t data = { { NULL }, 0, 52, -1 };
- int thread_id;
- int ret = EXIT_SUCCESS;
-
- if (!start_args_init(&data.base)) {
- printf("Stack allocation for thread failed\n");
- return EXIT_FAILURE;
- }
-
- thread_id = __wasi_thread_spawn(&data);
- if (thread_id < 0) {
- printf("Failed to create thread: %d\n", thread_id);
- ret = EXIT_FAILURE;
- goto final;
- }
-
- if (__builtin_wasm_memory_atomic_wait32(&data.th_ready, 0, SECOND) == 2) {
- printf("Timeout\n");
- ret = EXIT_FAILURE;
- goto final;
- }
-
- printf("Thread completed, new value: %d, thread id: %d\n", data.value,
- data.thread_id);
-
- assert(thread_id == data.thread_id);
-
-final:
- start_args_deinit(&data.base);
-
- return ret;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.S b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.S
deleted file mode 100644
index ea8fd1400..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.S
+++ /dev/null
@@ -1,22 +0,0 @@
-# A slightly modified copy of the wasi-libc implementation
-# https://github.com/WebAssembly/wasi-libc/pull/376/
- .globaltype __stack_pointer, i32
- .functype __wasi_thread_start_C (i32, i32) -> ()
-
- .globl wasi_thread_start
-
-wasi_thread_start:
- .functype wasi_thread_start (i32, i32) -> ()
-
- # Set up the minimum C environment.
- # Note: offsetof(start_arg, stack) == 0
- local.get 1 # start_arg
- i32.load 0 # stack
- global.set __stack_pointer
-
- # Make the C function do the rest of work.
- local.get 0 # tid
- local.get 1 # start_arg
- call __wasi_thread_start_C
-
- end_function \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.h
deleted file mode 100644
index a46917d0a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasi-threads/wasm-apps/wasi_thread_start.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-#ifndef WASI_THREAD_START_H
-#define WASI_THREAD_START_H
-
-#define STACK_SIZE 32 * 1024 // same as the main stack
-
-typedef struct {
- void *stack;
-} start_args_t;
-
-static inline int
-start_args_init(start_args_t *start_args)
-{
- start_args->stack = malloc(STACK_SIZE);
- if (!start_args->stack) {
- return 0;
- }
-
- start_args->stack += STACK_SIZE;
- return 1;
-}
-
-static inline void
-start_args_deinit(start_args_t *start_args)
-{
- free(start_args->stack - STACK_SIZE);
-}
-
-#endif \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/.gitignore
deleted file mode 100644
index ab998a6eb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/wasm/inc/**
-!/wasm/inc/.*
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/CMakeLists.txt
deleted file mode 100644
index 1325e110c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/CMakeLists.txt
+++ /dev/null
@@ -1,174 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-project(how-to-deal-with-import)
-
-include(CMakePrintHelpers)
-include(CTest)
-include(ExternalProject)
-include(FetchContent)
-
-#
-# dependencies
-#
-set(WAMR_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../)
-# wasm required headers
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${WARM_ROOT}/${WAMR_ROOT}/wamr-sdk/app/libc-builtin-sysroot/include/pthread.h
- ${CMAKE_CURRENT_LIST_DIR}/wasm/inc
-)
-
-# vmlib
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Resetdefault linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-if (NOT DEFINED WAMR_BUILD_AOT)
- # Enable AOT by default.
- set (WAMR_BUILD_AOT 1)
-endif ()
-if (NOT DEFINED WAMR_BUILD_INTERP)
- # Disable Interpreter by default
- set (WAMR_BUILD_INTERP 0)
-endif ()
-set(WAMR_BUILD_JIT 0)
-set(WAMR_BUILD_FAST_INTERP 1)
-set(WAMR_BUILD_LIB_PTHREAD 1)
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_LIBC_WASI 1)
-set(WAMR_BUILD_SIMD 0)
-
-# compiling and linking flags
-if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
-endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
-
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-target_link_libraries(vmlib INTERFACE dl m pthread)
-if(WAMR_BUILD_AOT EQUAL 1)
- target_compile_definitions(vmlib INTERFACE -DWASM_ENABLE_AOT=1)
-else()
- target_compile_definitions(vmlib INTERFACE -DWASM_ENABLE_AOT=0)
-endif()
-
-if(WAMR_BUILD_INTERP EQUAL 1)
- target_compile_definitions(vmlib INTERFACE -DWASM_ENABLE_INTERP=1)
-else()
- target_compile_definitions(vmlib INTERFACE -DWASM_ENABLE_INTERP=0)
-endif()
-
-if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- # ASAN + UBSAN
- target_compile_options(vmlib INTERFACE -fsanitize=address,undefined)
- target_link_options(vmlib INTERFACE -fsanitize=address,undefined)
-endif()
-
-# # MSAN
-# target_compile_options(vmlib INTERFACE -fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer)
-# target_link_options(vmlib INTERFACE -fsanitize=memory)
-
-# wamrc
-if(WAMR_BUILD_AOT EQUAL 1 AND WAMR_BUILD_INTERP EQUAL 0)
- ExternalProject_Add(wamrc
- PREFIX wamrc-build
- SOURCE_DIR ${WAMR_ROOT}/wamr-compiler
- CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${WAMR_ROOT}/wamr-compiler -B build
- BUILD_COMMAND ${CMAKE_COMMAND} --build build --target wamrc
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different build/wamrc ${CMAKE_CURRENT_BINARY_DIR}/wamrc
- )
-endif()
-
-#
-# host
-add_subdirectory(host)
-add_custom_target(
- install_host ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ./host/example1 .
- DEPENDS example1
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-# TODO: replace it with a find_package()
-set(WASI_SDK_DIR /opt/wasi-sdk-19.0/)
-set(WASI_TOOLCHAIN_FILE ${WASI_SDK_DIR}/share/cmake/wasi-sdk.cmake)
-set(WASI_SYS_ROOT ${WASI_SDK_DIR}/share/wasi-sysroot)
-
-#
-# wasm
-if(WAMR_BUILD_AOT EQUAL 1 AND WAMR_BUILD_INTERP EQUAL 0)
- ExternalProject_Add(wasm
- PREFIX wasm-build
- DEPENDS wamrc
- BUILD_ALWAYS TRUE
- SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/wasm
- CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_LIST_DIR}/wasm -B build
- -DWASI_SDK_PREFIX=${WASI_SDK_DIR}
- -DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
- -DCMAKE_SYSROOT=${WASI_SYS_ROOT}
- -DWASM_TO_AOT=ON
- -DWAMRC_PATH=${CMAKE_CURRENT_BINARY_DIR}/wamrc
- -DSOCKET_WASI_CMAKE=${WAMR_ROOT}/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake
- BUILD_COMMAND ${CMAKE_COMMAND} --build build
- INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
- )
-else()
- ExternalProject_Add(wasm
- PREFIX wasm-build
- BUILD_ALWAYS TRUE
- SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/wasm
- CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_LIST_DIR}/wasm -B build
- -DWASI_SDK_PREFIX=${WASI_SDK_DIR}
- -DCMAKE_TOOLCHAIN_FILE=${WASI_TOOLCHAIN_FILE}
- -DCMAKE_SYSROOT=${WASI_SYS_ROOT}
- -DSOCKET_WASI_CMAKE=${WAMR_ROOT}/core/iwasm/libraries/lib-socket/lib_socket_wasi.cmake
- BUILD_COMMAND ${CMAKE_COMMAND} --build build
- INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
- )
-endif()
-
-#
-# Test
-#
-add_test(
- NAME run_example1
- COMMAND ./example1
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/README.md
deleted file mode 100644
index 9b61a6e74..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/README.md
+++ /dev/null
@@ -1,174 +0,0 @@
-# How to create `imports` for wasm_instance_new() properly
-
-It's always been asked how to create `wasm_extern_vec_t *imports` for
-`wasm_instance_new()`?
-
-```c
-WASM_API_EXTERN own wasm_instance_t* wasm_instance_new(
- wasm_store_t*, const wasm_module_t*, const wasm_extern_vec_t *imports,
- own wasm_trap_t** trap
-);
-```
-
-`wasm_extern_vec_t *imports` is required to match the requirement of _the
-import section_ of a .wasm.
-
-```bash
-$ /opt/wabt-1.0.31/bin/wasm-objdump -j Import -x <some_example>.wasm
-
-Section Details:
-
-Import[27]:
- - func[0] sig=2 <pthread_mutex_lock> <- env.pthread_mutex_lock
- - func[1] sig=2 <pthread_mutex_unlock> <- env.pthread_mutex_unlock
- - func[2] sig=2 <pthread_cond_signal> <- env.pthread_cond_signal
- - func[3] sig=3 <host_log> <- env.log
- ...
- - func[11] sig=4 <__imported_wasi_snapshot_preview1_sock_bind> <- wasi_snapshot_preview1.sock_bind
- - func[12] sig=4 <__imported_wasi_snapshot_preview1_sock_connect> <- wasi_snapshot_preview1.sock_connect
- - func[13] sig=4 <__imported_wasi_snapshot_preview1_sock_listen> <- wasi_snapshot_preview1.sock_listen
- - func[14] sig=5 <__imported_wasi_snapshot_preview1_sock_open> <- wasi_snapshot_preview1.sock_open
- - func[15] sig=4 <__imported_wasi_snapshot_preview1_sock_addr_remote> <- wasi_snapshot_preview1.sock_addr_remote
- - func[16] sig=4 <__imported_wasi_snapshot_preview1_args_get> <- wasi_snapshot_preview1.args_get
- - func[17] sig=4 <__imported_wasi_snapshot_preview1_args_sizes_get> <- wasi_snapshot_preview1.args_sizes_get
- ...
-```
-
-Developers should fill in _imports_ with enough host functions and make sure
-there are no linking problems during instantiation.
-
-```bash
-TODO: linking warnings
-```
-
-## A natural way
-
-One natural answer is "to create a list which matches every item in _the import
-section_" of the .wasm. Since developers can see the section details of
-a .wasm by tools like _wasm-objdump_, the answer is doable. Most of the time,
-if they also prepare Wasm modules, developers have full control over import
-requirements, and they only need to take a look at the order of _the import
-section_.
-
-Yes, _the order_. A proper `wasm_extern_vec_t *imports` includes two things:
-
-1. how many `wasm_extern_t`
-2. and order of those
-
-Because there is no "name information" in a `wasm_extern_t`. The only way is let
-`wasm_instance_new()` to tell which item in _the import section_ of a .wasm
-should match any item in `wasm_extern_vec_t *imports` is based on **_index_**.
-
-The algorithm is quite straightforward. The first one of _the import section_ matches
-`wasm_extern_vec_t *imports->data[0] `. The second one matches `wasm_extern_vec_t *imports->data[1]`.
-And so on.
-
-So the order of `wasm_extern_vec_t *imports` becomes quite a burden. It requires
-developers always checking _the import section_ visually.
-
-Until here, the natural way is still workable although involving some handy work.
-Right?
-
-## A blocker
-
-Sorry, the situation changes a lot when driving wasm32-wasi Wasm modules with
-wasm-c-api.
-
-As you know, WASI provides _a set of crossing-platform standard libraries_ for
-Wasm modules, and leaves some _interfaces_ for native platform-dependent supports.
-Those _interfaces_ are those import items with the module name `wasi_snapshot_preview1`
-in a Wasm module.
-
-It seems not economical to let developers provide their version of host
-implementations of the `wasi_snapshot_preview1.XXX` functions. All those support
-should be packed into a common library and shared in different Wasm modules.
-Like a [cargo WASI](https://github.com/bytecodealliance/cargo-wasi).
-
-WAMR chooses to integrate the WASI support library in the runtime to reduce
-developers' compilation work. It brings developers a new thing of a proper
-`wasm_extern_vec_t *imports` that developers should avoid overwriting those items
-of _the import section_ of a Wasm module that will be provided by the runtime. It
-also not economical to code for those functions.
-
-Using module names as a filter seems to be a simple way. But some private
-additional c/c++ libraries are supported in WAMR. Those supporting will bring
-more import items that don't use `wasi_snapshot_preview1` as module names but are still
-covered by the WASM runtime. Like `env.pthread_`. Plus, [the native lib registeration](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md)
-provides another possible way to fill in the requirement of _the import section_.
-
-Let's take summarize. A proper `wasm_extern_vec_t *imports` should include:
-
-1. provides all necessary host implementations for items in _the import section_
-2. should not override runtime provided implementation or covered by native
- registrations. functinal or econmical.
-3. keep them in a right order
-
-## A recommendation
-
-The recommendation is:
-
-- use `wasm_module_imports()` to build the order
-- use `wasm_importtype_is_linked()` to avoid overwriting
-
-[wasm-c-api-imports](.) is a simple showcase of how to do that.
-
-First, let's take a look at the Wasm module. [send_recv](./wasm/send_recv.c)
-uses both standard WASI and WAMR_BUILD_LIB_PTHREAD supporting. Plus a private
-native function `host_log`.
-
-So, `wasm_extern_vec_t *imports` should only include the host implementation of
-`host_log` and avoid WASI related(`wasm-c-api-imports.XXX`) and pthread related(`env.pthread_XXX`).
-
-[Here is how to do](./host/example1.c):
-
-- get import types with `wasm_module_imports(0)`. it contains name information
-
-```c
- wasm_importtype_vec_t importtypes = { 0 };
- wasm_module_imports(module, &importtypes);
-```
-
-- traversal import types. The final `wasm_importvec_t *imports` should have the
- same order with `wasm_importtype_vec_t`
-
-```c
- for (unsigned i = 0; i < importtypes.num_elems; i++)
-```
-
-- use `wasm_importtype_is_linked()` to avoid those covered by the runtime and
- registered natives. A little tip is use "wasm_extern_new_empty()" to create
- a placeholder.
-
-```c
- /* use wasm_extern_new_empty() to create a placeholder */
- if (wasm_importtype_is_linked(importtype)) {
- externs[i] = wasm_extern_new_empty(
- store, wasm_externtype_kind(wasm_importtype_type(importtype)));
- continue;
- }
-```
-
-- use `wasm_importtype_module()` to get the module name, use `wasm_importtype_name()`
- to get the field name.
-
-```c
- const wasm_name_t *module_name =
- wasm_importtype_module(importtypes.data[i]);
- const wasm_name_t *field_name =
- wasm_importtype_name(importtypes.data[i]);
-```
-
-- fill in `wasm_externvec_t *imports` dynamically and programmatically.
-
-```c
- if (strncmp(module_name->data, "env", strlen("env")) == 0
- && strncmp(field_name->data, "log", strlen("log")) == 0) {
- wasm_functype_t *log_type = wasm_functype_new_2_0(
- wasm_valtype_new_i64(), wasm_valtype_new_i32());
- wasm_func_t *log_func = wasm_func_new(store, log_type, host_logs);
- wasm_functype_delete(log_type);
-
- externs[i] = wasm_func_as_extern(log_func);
- }
- }
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/CMakeLists.txt
deleted file mode 100644
index e2636f09e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required(VERSION 3.14)
-project(host)
-
-set(CMAKE_BUILD_TYPE Debug)
-
-#
-# host
-add_executable(example1 ./example1.c)
-target_link_libraries(example1 vmlib)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/example1.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/example1.c
deleted file mode 100644
index ccf574d79..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/host/example1.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "wasm_c_api.h"
-#include "wasm_export.h"
-
-static wasm_trap_t *
-host_logs(const wasm_val_vec_t *args, wasm_val_vec_t *results)
-{
- return NULL;
-}
-
-static bool
-build_imports(wasm_store_t *store, const wasm_module_t *module,
- wasm_extern_vec_t *out)
-{
- wasm_importtype_vec_t importtypes = { 0 };
- wasm_module_imports(module, &importtypes);
-
- wasm_extern_t *externs[32] = { 0 };
-
- for (unsigned i = 0; i < importtypes.num_elems; i++) {
- wasm_importtype_t *importtype = importtypes.data[i];
-
- /* use wasm_extern_new_empty() to create a placeholder */
- if (wasm_importtype_is_linked(importtype)) {
- externs[i] = wasm_extern_new_empty(
- store, wasm_externtype_kind(wasm_importtype_type(importtype)));
- continue;
- }
-
- const wasm_name_t *module_name =
- wasm_importtype_module(importtypes.data[i]);
- const wasm_name_t *field_name =
- wasm_importtype_name(importtypes.data[i]);
-
- if (strncmp(module_name->data, "env", strlen("env")) == 0
- && strncmp(field_name->data, "log", strlen("log")) == 0) {
- wasm_functype_t *log_type = wasm_functype_new_2_0(
- wasm_valtype_new_i64(), wasm_valtype_new_i32());
- wasm_func_t *log_func = wasm_func_new(store, log_type, host_logs);
- wasm_functype_delete(log_type);
-
- externs[i] = wasm_func_as_extern(log_func);
- }
- }
-
- wasm_extern_vec_new(out, importtypes.num_elems, externs);
- wasm_importtype_vec_delete(&importtypes);
- return true;
-}
-
-int
-main()
-{
- int main_ret = EXIT_FAILURE;
-
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t *engine = wasm_engine_new();
- if (!engine)
- goto quit;
-
- wasm_store_t *store = wasm_store_new(engine);
- if (!store)
- goto delete_engine;
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE *file = fopen("send_recv.aot", "rb");
- printf("> Load .aot\n");
-#else
- FILE *file = fopen("send_recv.wasm", "rb");
- printf("> Load .wasm\n");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- goto delete_store;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- goto close_file;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- goto close_file;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- goto close_file;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
-
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- goto delete_binary;
- }
-
- // Compile.
- printf("Compiling module...\n");
- wasm_module_t *module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- goto delete_binary;
- }
-
- // Set Wasi Context
- const char *addr_pool[1] = { "127.0.0.1" };
- wasm_runtime_set_wasi_addr_pool(*module, addr_pool, 1);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_vec_t imports = { 0 };
- ret = build_imports(store, module, &imports);
- if (!ret) {
- printf("> Error building imports!\n");
- goto delete_module;
- }
-
- wasm_instance_t *instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- goto delete_imports;
- }
-
- // Extract export.
- printf("Extracting export...\n");
- wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- goto delete_instance;
- }
-
- /**
- * should use information from wasm_module_exports to avoid hard coding "1"
- */
- const wasm_func_t *start_func = wasm_extern_as_func(exports.data[1]);
- if (start_func == NULL) {
- printf("> Error accessing export!\n");
- goto delete_exports;
- }
-
- // Call. "_start(nil) -> i32"
- printf("Calling _start ...\n");
- wasm_val_t rs[1] = { WASM_I32_VAL(0) };
- wasm_val_vec_t args = WASM_EMPTY_VEC;
- wasm_val_vec_t results = WASM_ARRAY_VEC(rs);
- wasm_trap_t *trap = wasm_func_call(start_func, &args, &results);
- if (trap) {
- wasm_name_t message = { 0 };
- wasm_trap_message(trap, &message);
-
- printf("> Error calling function! %s\n", message.data);
-
- wasm_name_delete(&message);
- wasm_trap_delete(trap);
- goto delete_exports;
- }
-
- // Print result.
- printf("Printing result...\n");
- printf("> %u\n", rs[0].of.i32);
-
- // Shut down.
- printf("Shutting down...\n");
-
- // All done.
- printf("Done.\n");
- main_ret = EXIT_SUCCESS;
-
-delete_exports:
- wasm_extern_vec_delete(&exports);
-delete_instance:
- wasm_instance_delete(instance);
-delete_imports:
- wasm_extern_vec_delete(&imports);
-delete_module:
- wasm_module_delete(module);
-delete_binary:
- wasm_byte_vec_delete(&binary);
-close_file:
- fclose(file);
-delete_store:
- wasm_store_delete(store);
-delete_engine:
- wasm_engine_delete(engine);
-quit:
- return main_ret;
-} \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/CMakeLists.txt
deleted file mode 100644
index 6b2743cb5..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-project(wasm_modules)
-
-if(NOT SOCKET_WASI_CMAKE)
- message(FATAL_ERROR "Require SOCKET_WASI_CMAKE")
-endif()
-
-option(WASM_TO_AOT "transfer wasm to aot" OFF)
-if(WASM_TO_AOT AND NOT WAMRC_PATH)
- message(FATAL_ERROR "Require WAMRC_PATH when WASM_TO_AOT is ON")
-endif()
-
-#
-# c -> wasm
-include(${SOCKET_WASI_CMAKE})
-add_executable(send_recv ${CMAKE_CURRENT_LIST_DIR}/send_recv.c)
-set_target_properties(send_recv PROPERTIES SUFFIX .wasm)
-target_include_directories(send_recv PUBLIC ${CMAKE_CURRENT_LIST_DIR}/inc)
-target_link_libraries(send_recv socket_wasi_ext)
-target_link_options(send_recv PRIVATE
- LINKER:--export=__heap_base
- LINKER:--export=__data_end
- LINKER:--shared-memory,--max-memory=196608
- LINKER:--no-check-features
- LINKER:--allow-undefined
-)
-
-if(WASM_TO_AOT)
- # wasm -> aot
- add_custom_target(send_recv_aot ALL
- COMMAND pwd && ${WAMRC_PATH} --enable-multi-thread -o ./send_recv.aot ./send_recv.wasm
- DEPENDS send_recv
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
-endif()
-
-#
-# install
-if(WASM_TO_AOT)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/send_recv.aot DESTINATION . )
-else()
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/send_recv.wasm DESTINATION . )
-endif()
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/inc/.gitkeep b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/inc/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/inc/.gitkeep
+++ /dev/null
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/send_recv.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/send_recv.c
deleted file mode 100644
index d9f95573a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api-imports/wasm/send_recv.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <arpa/inet.h>
-#include <assert.h>
-#include <netinet/in.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#ifdef __wasi__
-#include <wasi_socket_ext.h>
-#include "pthread.h"
-#else
-#include <pthread.h>
-#endif
-
-static pthread_mutex_t lock = { 0 };
-static pthread_cond_t cond = { 0 };
-static bool server_create_failed = false;
-static bool server_is_ready = false;
-
-#ifdef __wasi__
-__attribute__((import_name("log"))) extern void
-host_log(uint64_t message, uint32_t length);
-#endif
-
-static void
-local_printf(const char *formatter, ...)
-{
- char buffer[128] = { 0 };
- va_list args;
-
- va_start(args, formatter);
- vsnprintf(buffer, 128, formatter, args);
- va_end(args);
-
-#ifdef __wasi__
- host_log((uint64_t)(void *)buffer, strlen(buffer));
-#endif
- printf("--> %s", buffer);
-}
-
-void *
-run_as_server(void *arg)
-{
- int sock = -1, on = 1;
- struct sockaddr_in addr = { 0 };
- int addrlen = 0;
- int new_sock = -1;
- char *buf[] = {
- "The stars shine down", "It brings us light", "Light comes down",
- "To make us paths", "It watches us", "And mourns for us",
- };
- struct iovec iov[] = {
- { .iov_base = buf[0], .iov_len = strlen(buf[0]) + 1 },
- { .iov_base = buf[1], .iov_len = strlen(buf[1]) + 1 },
- { .iov_base = buf[2], .iov_len = strlen(buf[2]) + 1 },
- { .iov_base = buf[3], .iov_len = strlen(buf[3]) + 1 },
- { .iov_base = buf[4], .iov_len = strlen(buf[4]) + 1 },
- { .iov_base = buf[5], .iov_len = strlen(buf[5]) + 1 },
- };
- struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 6 };
- ssize_t send_len = 0;
-
- pthread_mutex_lock(&lock);
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if (sock < 0) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Create a socket failed");
- return NULL;
- }
-
-#ifndef __wasi__
- if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on))) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Setsockopt failed");
- goto fail1;
- }
-#endif
-
- /* 0.0.0.0:1234 */
- addr.sin_family = AF_INET;
- addr.sin_port = htons(1234);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- addrlen = sizeof(addr);
- if (bind(sock, (struct sockaddr *)&addr, addrlen) < 0) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Bind failed");
- goto fail1;
- }
-
- if (listen(sock, 0) < 0) {
- server_create_failed = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
- perror("Listen failed");
- goto fail1;
- }
-
- server_is_ready = true;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&lock);
-
- local_printf("Server is online ... \n");
-
- new_sock = accept(sock, (struct sockaddr *)&addr, (socklen_t *)&addrlen);
- if (new_sock < 0) {
- perror("Accept failed");
- goto fail1;
- }
-
- local_printf("Start sending. \n");
- send_len = sendmsg(new_sock, &msg, 0);
- if (send_len < 0) {
- perror("Sendmsg failed");
- goto fail2;
- }
- local_printf("Send %ld bytes successfully!\n", send_len);
-
-fail2:
- close(new_sock);
-fail1:
- shutdown(sock, SHUT_RD);
- close(sock);
- return NULL;
-}
-
-void *
-run_as_client(void *arg)
-{
- int sock = -1;
- struct sockaddr_in addr = { 0 };
- /* buf of server is 106 bytes */
- char buf[110] = { 0 };
- struct iovec iov = { .iov_base = buf, .iov_len = sizeof(buf) };
- struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1 };
- ssize_t recv_len = 0;
-
- pthread_mutex_lock(&lock);
- while (!server_create_failed && !server_is_ready) {
- pthread_cond_wait(&cond, &lock);
- }
- pthread_mutex_unlock(&lock);
-
- if (server_create_failed) {
- return NULL;
- }
-
- local_printf("Client is running...\n");
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if (sock < 0) {
- perror("Create a socket failed");
- return NULL;
- }
-
- /* 127.0.0.1:1234 */
- addr.sin_family = AF_INET;
- addr.sin_port = htons(1234);
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- perror("Connect failed");
- goto fail;
- }
-
- local_printf("Start receiving. \n");
- recv_len = recvmsg(sock, &msg, 0);
- if (recv_len < 0) {
- perror("Recvmsg failed");
- goto fail;
- }
-
- local_printf("Receive %ld bytes successlly!\n", recv_len);
- assert(recv_len == 106);
-
- local_printf("Data:\n");
- char *s = msg.msg_iov->iov_base;
- while (strlen(s) > 0) {
- local_printf(" %s\n", s);
- s += strlen(s) + 1;
- }
-
-fail:
- shutdown(sock, SHUT_RD);
- close(sock);
- return NULL;
-}
-
-int
-main(int argc, char *argv[])
-{
- pthread_t cs[2] = { 0 };
- uint8_t i = 0;
- int ret = EXIT_SUCCESS;
-
- if (pthread_mutex_init(&lock, NULL)) {
- perror("Initialize mutex failed");
- ret = EXIT_FAILURE;
- goto RETURN;
- }
-
- if (pthread_cond_init(&cond, NULL)) {
- perror("Initialize condition failed");
- ret = EXIT_FAILURE;
- goto DESTROY_MUTEX;
- }
-
- if (pthread_create(&cs[0], NULL, run_as_server, NULL)) {
- perror("Create a server thread failed");
- ret = EXIT_FAILURE;
- goto DESTROY_COND;
- }
-
- if (pthread_create(&cs[1], NULL, run_as_client, NULL)) {
- perror("Create a client thread failed");
- ret = EXIT_FAILURE;
- goto DESTROY_COND;
- }
-
- for (i = 0; i < 2; i++) {
- pthread_join(cs[i], NULL);
- }
-
-DESTROY_COND:
- pthread_cond_destroy(&cond);
-DESTROY_MUTEX:
- pthread_mutex_destroy(&lock);
-RETURN:
- return ret;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/CMakeLists.txt
deleted file mode 100644
index c528fe16d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/CMakeLists.txt
+++ /dev/null
@@ -1,210 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-include(CheckPIESupported)
-
-if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
- project(c-api)
-else()
- project (c-api C ASM)
- enable_language (ASM_MASM)
-endif()
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
-endif()
-
-set(CMAKE_CXX_STANDARD 14)
-################ runtime settings ################
-
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Reset default linker flags
-set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if(NOT DEFINED WAMR_BUILD_INTERP)
- set(WAMR_BUILD_INTERP 1)
-endif()
-
-if(NOT DEFINED WAMR_BUILD_AOT)
- set(WAMR_BUILD_AOT 0)
-endif()
-
-if(NOT DEFINED WAMR_BUILD_JIT)
- set(WAMR_BUILD_JIT 0)
-endif()
-
-set(WAMR_BUILD_LIBC_BUILTIN 1)
-set(WAMR_BUILD_LIBC_WASI 0)
-set(WAMR_BUILD_MULTI_MODULE 1)
-set(WAMR_BUILD_DUMP_CALL_STACK 1)
-set(WAMR_BUILD_REF_TYPES 1)
-
-if(NOT DEFINED WAMR_BUILD_FAST_INTERP)
- set(WAMR_BUILD_FAST_INTERP 1)
-endif()
-
-if (NOT MSVC)
- # compiling and linking flags
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
- endif ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
- if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
- endif ()
- endif ()
-endif()
-# build out vmlib
-set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-if (NOT DEFINED SANITIZER)
- set(SANITIZER "")
-elseif (SANITIZER STREQUAL "ubsan")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=alignment" )
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
-elseif (NOT (SANITIZER STREQUAL "") )
- message(SEND_ERROR "Unsupported sanitizer: ${SANITIZER}")
-endif()
-
-add_library(vmlib STATIC ${WAMR_RUNTIME_LIB_SOURCE})
-if (MSVC)
- target_compile_definitions(vmlib PRIVATE WASM_API_EXTERN=)
-endif()
-target_link_libraries (vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)
-
-if (WAMR_BUILD_WASM_CACHE EQUAL 1)
- target_link_libraries(vmlib boringssl_crypto)
-endif ()
-################################################
-
-################ application related ################
-## locate wat2wasm
-find_program(WAT2WASM
- wat2wasm
- PATHS /opt/wabt/bin
- REQUIRED
-)
-
-if(NOT WAT2WASM)
- message(SEND_ERROR "can not find wat2wasm")
-else ()
- execute_process(COMMAND ${WAT2WASM} --version
- OUTPUT_VARIABLE WAT2WASM_VERSION_OUTPUT)
- string(STRIP ${WAT2WASM_VERSION_OUTPUT} WAT2WASM_VERSION)
- message("-- Found wat2wasm ${WAT2WASM_VERSION}")
-endif()
-
-if (${WAT2WASM_VERSION} VERSION_LESS 1.0.26)
- set(WAT2WASM_FLAGS "--enable-reference-types")
-endif ()
-
-if(${WAMR_BUILD_AOT} EQUAL 1)
- ## locate wamrc
- find_program(WAMRC
- wamrc
- PATHS ${WAMR_ROOT_DIR}/wamr-compiler/build/
- )
-
- if(NOT WAMRC)
- message(SEND_ERROR "can not find wamrc. refer to \
- https://github.com/bytecodealliance/wasm-micro-runtime#build-wamrc-aot-compiler"
- )
- endif()
-endif()
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-set(MM_UTIL src/utils/multi_module_utils.c)
-# build executable for each .c
-list(APPEND EXAMPLES callback callback_chain empty_imports global hello hostref memory reflect table trap)
-# FIXME enable both in the future
-#list(APPEND EXAMPLES clone threads)
-# FIXME
-# if(WAMR_BUILD_JIT EQUAL 1 AND WAMR_BUILD_LAZY_JIT EQUAL 0)
-# list(APPEND EXAMPLES serialize)
-# endif()
-
-check_pie_supported()
-
-include(CTest)
-enable_testing()
-
-foreach(EX ${EXAMPLES})
- set(SRC ${CMAKE_CURRENT_LIST_DIR}/src/${EX}.c)
-
- add_executable(${EX} ${SRC} ${UNCOMMON_SHARED_SOURCE} ${MM_UTIL})
- set_target_properties (${EX} PROPERTIES POSITION_INDEPENDENT_CODE ON)
- target_include_directories(${EX} PRIVATE ${UNCOMMON_SHARED_DIR})
- target_link_libraries(${EX} vmlib)
- if (MSVC)
- target_compile_definitions(${EX} PRIVATE WASM_API_EXTERN=)
- endif()
-
- # wat to wasm
- set(WAT ${CMAKE_CURRENT_LIST_DIR}/src/${EX}.wat)
-
- add_custom_target(${EX}_WASM
- COMMAND ${WAT2WASM} ${WAT} ${WAT2WASM_FLAGS} -o ${PROJECT_BINARY_DIR}/${EX}.wasm
- DEPENDS ${WAT}
- BYPRODUCTS ${PROJECT_BINARY_DIR}/${EX}.wasm
- VERBATIM
- )
- add_dependencies(${EX} ${EX}_WASM)
-
- # generate .aot file
- if(${WAMR_BUILD_AOT} EQUAL 1)
- add_custom_target(${EX}_AOT
- COMMAND ${WAMRC} -o ${PROJECT_BINARY_DIR}/${EX}.aot
- ${PROJECT_BINARY_DIR}/${EX}.wasm
- DEPENDS ${EX}_WASM
- BYPRODUCTS ${PROJECT_BINARY_DIR}/${EX}.aot
- VERBATIM
- COMMENT "generate a aot file ${PROJECT_BINARY_DIR}/${EX}.aot"
- )
- add_dependencies(${EX} ${EX}_AOT)
- endif()
-
- # run `ctest --test-dir build`
- add_test(NAME Test_${EX}
- COMMAND ./${EX}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
-endforeach()
-
-if (CMAKE_BUILD_TYPE STREQUAL "Debug")
- find_program(VALGRIND
- valgrind
- REQUIRED
- )
-
- # run `ctest -T memcheck -V --test-dir build`
-endif()
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/README.md
deleted file mode 100644
index b23276706..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-WAMR supports *wasm-c-api* in both *interpreter* mode and *aot* mode.
-
-Before staring, we need to download and intall [WABT](https://github.com/WebAssembly/wabt/releases/latest).
-
-``` shell
-$ cd /opt
-$ wget https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz
-$ tar -xzf wabt-1.0.31-ubuntu.tar.gz
-$ mv wabt-1.0.31 wabt
-```
-
-By default, all samples are compiled and run in "interpreter" mode.
-
-
-``` shell
-$ mkdir build
-$ cd build
-$ cmake ..
-$ make
-$ # it will build a library with c-api supporting.
-$ # Also copy *.wasm from ../src/
-$ # and generate executable files
-$ # now, it is ok to run samples
-$ ./hello
-$ ...
-$ ./global
-$ ...
-$ ./callback
-$ ...
-```
-
-They can be compiled and run in *aot* mode when some compiling flags are given.
-
-``` shell
-$ mkdir build
-$ cd build
-$ cmake -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_AOT=1 ..
-$ make
-$ # it will build a library with c-api supporting.
-$ # Also copy *.wasm from ../src/
-$ # and transform *.wasm to *.aot
-$ # and generate executable files
-$ # now, it is ok to run samples
-$ ./hello
-$ ...
-$ ./global
-$ ...
-$ ./callback
-$ ...
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/LICENSE b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/LICENSE
deleted file mode 100644
index 8f71f43fe..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.c
deleted file mode 100644
index ccb9ec067..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.c
+++ /dev/null
@@ -1,193 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-// Print a Wasm value
-void wasm_val_print(wasm_val_t val) {
- switch (val.kind) {
- case WASM_I32: {
- printf("%" PRIu32, val.of.i32);
- } break;
- case WASM_I64: {
- printf("%" PRIu64, val.of.i64);
- } break;
- case WASM_F32: {
- printf("%f", val.of.f32);
- } break;
- case WASM_F64: {
- printf("%g", val.of.f64);
- } break;
- case WASM_ANYREF:
- case WASM_FUNCREF: {
- if (val.of.ref == NULL) {
- printf("null");
- } else {
- printf("ref(%p)", val.of.ref);
- }
- } break;
- }
-}
-
-// A function to be called from Wasm code.
-own wasm_trap_t* print_callback(
- const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- printf("Calling back...\n> ");
- wasm_val_print(args->data[0]);
- printf("\n");
-
- wasm_val_copy(&results->data[0], &args->data[0]);
- return NULL;
-}
-
-
-// A function closure.
-own wasm_trap_t* closure_callback(
- void* env, const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- int i = *(int*)env;
- printf("Calling back closure...\n");
- printf("> %d\n", i);
-
- results->data[0].kind = WASM_I32;
- results->data[0].of.i32 = (int32_t)i;
- return NULL;
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("callback.aot", "rb");
-#else
- FILE* file = fopen("callback.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Create external print functions.
- printf("Creating callback...\n");
- own wasm_functype_t* print_type = wasm_functype_new_1_1(wasm_valtype_new_i32(), wasm_valtype_new_i32());
- own wasm_func_t* print_func = wasm_func_new(store, print_type, print_callback);
-
- int i = 42;
- own wasm_functype_t* closure_type = wasm_functype_new_0_1(wasm_valtype_new_i32());
- own wasm_func_t* closure_func = wasm_func_new_with_env(store, closure_type, closure_callback, &i, NULL);
-
- wasm_functype_delete(print_type);
- wasm_functype_delete(closure_type);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_t* externs[] = {
- wasm_func_as_extern(print_func), wasm_func_as_extern(closure_func)
- };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_func_delete(print_func);
- wasm_func_delete(closure_func);
-
- // Extract export.
- printf("Extracting export...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- return 1;
- }
- const wasm_func_t* run_func = wasm_extern_as_func(exports.data[0]);
- if (run_func == NULL) {
- printf("> Error accessing export!\n");
- return 1;
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
-
- // Call.
- printf("Calling export...\n");
- wasm_val_t as[2] = { WASM_I32_VAL(3), WASM_I32_VAL(4) };
- wasm_val_t rs[1] = { WASM_INIT_VAL };
- wasm_val_vec_t args = WASM_ARRAY_VEC(as);
- wasm_val_vec_t results = WASM_ARRAY_VEC(rs);
- wasm_trap_t *trap = wasm_func_call(run_func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- return 1;
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Print result.
- printf("Printing result...\n");
- printf("> %u\n", rs[0].of.i32);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.wat
deleted file mode 100644
index d86195f51..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback.wat
+++ /dev/null
@@ -1,10 +0,0 @@
-(module
- (func $print (import "" "print") (param i32) (result i32))
- (func $closure (import "" "closure") (result i32))
- (func (export "run") (param $x i32) (param $y i32) (result i32)
- (i32.add
- (call $print (i32.add (local.get $x) (local.get $y)))
- (call $closure)
- )
- )
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.c
deleted file mode 100644
index e4f5801dc..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-static const byte_t *
-get_memory_data(uint32_t offset, uint32_t length);
-
-static bool
-call_wasm_function(uint32_t export_id, const wasm_val_vec_t *args,
- wasm_val_vec_t *results, const char *name);
-
-/************************ IMPORTED FUNCTIONS **************************/
-
-// (nil) -> i32
-#define FUNCTION_TYPE_NIL_I32 wasm_functype_new_0_1(wasm_valtype_new_i32())
-// (i32, i32) -> nil
-#define FUNCTION_TYPE_I32X2_NIL \
- wasm_functype_new_2_0(wasm_valtype_new_i32(), wasm_valtype_new_i32())
-
-/* IMPORT FUNCTION LIST */
-#define IMPORT_FUNCTION_LIST(V) \
- V(get_pairs, 0, FUNCTION_TYPE_NIL_I32) \
- V(log, 1, FUNCTION_TYPE_I32X2_NIL)
-
-/* EXPORT FUNCTION LIST */
-#define EXPORT_FUNCTION_LIST(V) \
- V(on_start) \
- V(on_stop) \
- V(malloc) \
- V(free)
-
-enum EXPORT_ITEM_NAME {
-#define DEFINE_ENUM(name) e_##name,
- EXPORT_FUNCTION_LIST(DEFINE_ENUM)
-#undef DEFINE_ENUM
- e_MEMORY,
-};
-
-#define DEFINE_FUNCTION(name) \
- wasm_trap_t *STUB_##name(const wasm_val_vec_t *args, \
- wasm_val_vec_t *results)
-
-#define DEFINE_EMPTY_FUNCTION(name) \
- DEFINE_FUNCTION(name) \
- { \
- printf("[WASM -> NATIVE] calling back %s\n", __FUNCTION__); \
- return NULL; \
- }
-#undef DEFINE_EMPTY_FUNCTION
-
-DEFINE_FUNCTION(get_pairs)
-{
- wasm_val_vec_t as = { 0 };
- wasm_val_t data[1] = { WASM_I32_VAL(10) };
- wasm_val_vec_new(&as, 1, data);
- if (as.data == NULL) {
- printf("ERROR: create parameters failed\n");
- return NULL;
- }
-
- call_wasm_function(e_malloc, &as, results, "malloc");
-
- wasm_val_vec_delete(&as);
- return NULL;
-}
-
-DEFINE_FUNCTION(log)
-{
- wasm_val_t offset = args->data[0];
- wasm_val_t length = args->data[1];
- const byte_t *data = NULL;
-
- printf("[WASM -> NATIVE] calling back %s\n", __FUNCTION__);
-
- if (offset.kind != WASM_I32 || length.kind != WASM_I32) {
- printf("> Error value type!\n");
- }
-
- if (!(data = get_memory_data(offset.of.i32, length.of.i32))) {
- return NULL;
- }
-
- if (data[length.of.i32 - 1]) {
- printf("> Error terminated character\n");
- return NULL;
- }
-
- printf("[WASM_LOG] %s\n", data);
- return NULL;
-}
-
-/**********************************************************************/
-// all exportted wasm functions. check with "/opt/wabt/bin/wasm-objdump -x -j
-// Export X.wasm" -1: memory 0-32: functions
-static own wasm_extern_vec_t exports = { 0 };
-
-static const byte_t *
-get_memory_data(uint32_t offset, uint32_t length)
-{
- wasm_memory_t *memory;
-
- if (!(memory = wasm_extern_as_memory(exports.data[e_MEMORY]))) {
- return NULL;
- }
-
- byte_t *base = wasm_memory_data(memory);
- size_t size = wasm_memory_data_size(memory);
- if (!base || offset + length > size) {
- return NULL;
- }
-
- printf("[NATIVE -> WASM] accessing the memory...\n");
-
- return base + offset;
-}
-
-static bool
-call_wasm_function(uint32_t export_id, const wasm_val_vec_t *args,
- wasm_val_vec_t *results, const char *name)
-{
- const wasm_func_t *function;
- wasm_trap_t *trap;
-
- printf("[NATIVE -> WASM] calling func %s...\n", name);
-
- if (!(function = wasm_extern_as_func(exports.data[export_id]))) {
- printf("> Error get export function %u\n", export_id);
- return false;
- }
-
- if ((trap = wasm_func_call(function, args, results))) {
- own wasm_message_t message = { 0 };
- wasm_trap_message(trap, &message);
-
- if (message.data) {
- printf("> Error calling function %s\n", message.data);
- }
- else {
- printf("> Error calling function");
- }
-
- wasm_name_delete(&message);
- wasm_trap_delete(trap);
- return false;
- }
- return true;
-}
-
-int
-main(int argc, const char *argv[])
-{
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t *engine = wasm_engine_new();
- wasm_store_t *store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE *file = fopen("callback_chain.aot", "rb");
-#else
- FILE *file = fopen("callback_chain.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t *module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Instantiate.
- printf("Instantiating module...\n");
-
- // Create external functions.
- printf("Creating callback...\n");
-#define IMPORT_FUNCTION_VARIABLE_NAME(name, ...) \
- own wasm_func_t *function_##name = NULL;
- IMPORT_FUNCTION_LIST(IMPORT_FUNCTION_VARIABLE_NAME)
-#undef IMPORT_FUNCTION_VARIABLE_NAME
-
-#define CREATE_WASM_FUNCTION(name, index, CREATE_FUNC_TYPE) \
- { \
- own wasm_functype_t *type = CREATE_FUNC_TYPE; \
- if (!(function_##name = wasm_func_new(store, type, STUB_##name))) { \
- printf("> Error creating new function\n"); \
- return 1; \
- } \
- wasm_functype_delete(type); \
- }
- IMPORT_FUNCTION_LIST(CREATE_WASM_FUNCTION)
-#undef CREATE_WASM_FUNCTION
-
- wasm_extern_t *fs[2] = { 0 };
-#define ADD_TO_FUNCTION_LIST(name, index, ...) \
- fs[index] = wasm_func_as_extern(function_##name);
- IMPORT_FUNCTION_LIST(ADD_TO_FUNCTION_LIST)
-#undef ADD_TO_FUNCTION_LIST
-
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(fs);
- own wasm_instance_t *instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
-#define DESTROY_WASM_FUNCITON(name, index, ...) \
- wasm_func_delete(function_##name);
- IMPORT_FUNCTION_LIST(DESTROY_WASM_FUNCITON)
-#undef DESTROY_WASM_FUNCITON
-
- // Extract export.
- printf("Extracting export...\n");
- wasm_instance_exports(instance, &exports);
- if (!exports.size) {
- printf("> Error accessing exports!\n");
- return 1;
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
-
- // Call.
- printf("Calling export...\n");
-
- if (!call_wasm_function(e_on_start, NULL, NULL, "on_start")) {
- printf("> Error calling on_start\n");
- return 1;
- }
-
- if (!call_wasm_function(e_on_stop, NULL, NULL, "on_stop")) {
- printf("> Error calling on_stop\n");
- return 1;
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.wat
deleted file mode 100644
index 80bbf4f74..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/callback_chain.wat
+++ /dev/null
@@ -1,32 +0,0 @@
-;; Copyright (C) 2019 Intel Corporation. All rights reserved.
-;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-(module
- (func $get_pairs (import "" "get_pairs") (result i32))
- (func $log (import "" "log") (param i32 i32))
-
- (func $on_start (export "on_start")
- (call $log (i32.const 0) (i32.const 9))
- (call $get_pairs)
- (drop)
- )
-
- (func $on_stop (export "on_stop")
- (call $log (i32.const 9) (i32.const 8))
- )
-
- (func $malloc (export "malloc") (param i32) (result i32)
- (call $log (i32.const 17) (i32.const 7))
- (i32.const 64)
- )
-
- (func $free(export "free") (param i32)
- (call $log (i32.const 24) (i32.const 5))
- )
-
- (memory (export "memory") 1)
- (data (i32.const 0) "on_start")
- (data (i32.const 9) "on_stop")
- (data (i32.const 17) "malloc")
- (data (i32.const 24) "free")
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.c
deleted file mode 100644
index da83b3790..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "wasm_c_api.h"
-
-#define WORKER_NUMBER 10
-
-/******************************* VM *******************************/
-/* Use wasm_vm_t and vm_xxx to simulate a minimal Wasm VM in Envoy */
-
-typedef struct _vm {
- wasm_engine_t *engine;
- wasm_store_t *store;
- wasm_module_t *module;
- wasm_shared_module_t *shared_module;
- wasm_instance_t *instance;
- wasm_func_t **function_list;
- wasm_memory_t *memory;
- wasm_table_t *table;
- wasm_extern_vec_t *exports;
-} wasm_vm_t;
-
-typedef enum _clone_level {
- not_cloneable = 0,
- compiled_bytecode,
- instantiated_module
-} clone_level;
-
-typedef struct _thread_arg_t {
- char name[32];
- bool *ready_go_flag;
- pthread_mutex_t *ready_go_lock;
- pthread_cond_t *ready_go_cond;
- const wasm_vm_t *base_vm;
-} thread_arg_t;
-
-wasm_vm_t *
-vm_new()
-{
- wasm_vm_t *vm = NULL;
-
- vm = malloc(sizeof(struct _vm));
- if (!vm)
- goto fail;
-
- memset(vm, 0, sizeof(wasm_vm_t));
-
- vm->engine = wasm_engine_new();
- if (!vm->engine)
- goto fail;
-
- vm->store = wasm_store_new(vm->engine);
- if (!vm->store)
- goto fail;
-
- return vm;
-
-fail:
- if (vm) {
- if (vm->engine)
- wasm_engine_delete(vm->engine);
-
- free(vm);
- }
- return NULL;
-}
-
-wasm_vm_t *
-vm_release(wasm_vm_t *vm)
-{
- if (!vm)
- return NULL;
-
- if (vm->function_list) {
- free(vm->function_list);
- vm->function_list = NULL;
- }
-
- vm->memory = NULL;
-
- if (vm->exports) {
- wasm_extern_vec_delete(vm->exports);
- free(vm->exports);
- vm->exports = NULL;
- }
-
- wasm_instance_delete(vm->instance);
- vm->instance = NULL;
-
- wasm_shared_module_delete(vm->shared_module);
- vm->shared_module = NULL;
-
- wasm_module_delete(vm->module);
- vm->module = NULL;
-
- wasm_store_delete(vm->store);
- vm->store = NULL;
-
- wasm_engine_delete(vm->engine);
- vm->engine = NULL;
-
- free(vm);
- return NULL;
-}
-
-bool
-vm_load(wasm_vm_t *vm, const wasm_byte_vec_t *binary)
-{
- vm->module = wasm_module_new(vm->store, binary);
- vm->shared_module = wasm_module_share(vm->module);
- return vm->module != NULL;
-}
-
-bool
-vm_link(wasm_vm_t *vm, wasm_extern_vec_t *imports)
-{
- vm->instance = wasm_instance_new(vm->store, vm->module, imports, NULL);
- if (!vm->instance)
- goto fail;
-
- vm->exports = malloc(sizeof(wasm_extern_vec_t));
- if (!vm->exports)
- goto fail;
-
- memset(vm->exports, 0, sizeof(wasm_extern_vec_t));
- wasm_instance_exports(vm->instance, vm->exports);
- /* an exported memory, and two exported functions */
- assert(vm->exports->size == 3);
-
- /* bind memory */
- assert(wasm_extern_kind(vm->exports->data[0]) == WASM_EXTERN_MEMORY);
- vm->memory = wasm_extern_as_memory(vm->exports->data[0]);
-
- vm->function_list = malloc(2 * sizeof(wasm_func_t *));
- if (!vm->function_list)
- goto fail;
-
- memset(vm->function_list, 0, 2 * sizeof(wasm_func_t *));
-
- /* bind wasm_set_byte(...) */
- assert(wasm_extern_kind(vm->exports->data[1]) == WASM_EXTERN_FUNC);
- vm->function_list[0] = wasm_extern_as_func(vm->exports->data[1]);
-
- /* bind wasm_get_byte(...) */
- assert(wasm_extern_kind(vm->exports->data[2]) == WASM_EXTERN_FUNC);
- vm->function_list[1] = wasm_extern_as_func(vm->exports->data[2]);
-
- return true;
-fail:
- return false;
-}
-
-wasm_vm_t *
-vm_clone_from_module(const wasm_vm_t *base)
-{
- printf("Initializing...\n");
- wasm_vm_t *secondary = NULL;
-
- secondary = vm_new();
- if (secondary) {
- printf("Reuse module and bypass vm_load()...");
- secondary->module =
- wasm_module_obtain(base->store, base->shared_module);
- if (!secondary->module)
- secondary = vm_release(secondary);
- }
-
- return secondary;
-}
-
-wasm_vm_t *
-vm_clone_from_instance(const wasm_vm_t *base)
-{
- /**
- * if do a clone of the level instantiated_module, need to malloc and
- * initialie
- * - global. WASMGlobalIntance and global data
- * - memory. WAAMMemoryInstance, memory_data and heap
- * - table. WASMTableInstance, table_data
- * - exports. all global, memory and table
- *
- * it is almost everything in wasm_instantiate() except funciton.
- */
- (void)base;
- printf("Unsupported\n");
- return NULL;
-}
-
-wasm_vm_t *
-vm_clone(const wasm_vm_t *base, clone_level level)
-{
- if (level == not_cloneable)
- return NULL;
-
- if (level == compiled_bytecode)
- return vm_clone_from_module(base);
- else
- return vm_clone_from_instance(base);
-}
-
-bool
-vm_memory_set_byte(const wasm_vm_t *vm, uint32_t offset, uint8_t byte)
-{
- byte_t *data = wasm_memory_data(vm->memory);
- assert(data);
- *(data + offset) = byte;
- return true;
-}
-
-bool
-vm_memory_get_byte(const wasm_vm_t *vm, uint32_t offset, uint8_t *byte)
-{
- byte_t *data = wasm_memory_data(vm->memory);
- assert(data);
- *byte = *(data + offset);
- return true;
-}
-
-bool
-vm_function_set_byte(const wasm_vm_t *vm, uint32_t offset, uint8_t byte)
-{
- wasm_val_t a_v[2] = { WASM_I32_VAL(offset), WASM_I32_VAL(byte) };
- wasm_val_vec_t args = WASM_ARRAY_VEC(a_v);
- wasm_val_vec_t results = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(vm->function_list[0], &args, &results);
- if (trap) {
- printf("call wasm_set_byte failed");
- wasm_trap_delete(trap);
- return false;
- }
-
- return true;
-}
-
-bool
-vm_function_get_byte(const wasm_vm_t *vm, uint32_t offset, uint8_t *byte)
-{
- wasm_val_t a_v[1] = { WASM_I32_VAL(offset) };
- wasm_val_vec_t args = WASM_ARRAY_VEC(a_v);
- wasm_val_t r_v[1] = { WASM_INIT_VAL };
- wasm_val_vec_t results = WASM_ARRAY_VEC(r_v);
- wasm_trap_t *trap = wasm_func_call(vm->function_list[1], &args, &results);
- if (trap) {
- printf("call wasm_get_byte failed");
- wasm_trap_delete(trap);
- return false;
- }
-
- assert(results.data->kind == WASM_I32);
- *byte = results.data->of.i32;
- return true;
-}
-
-static bool
-load_wasm_file_content(const char *file_name, wasm_byte_vec_t *out)
-{
- bool ret = false;
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE *file = fopen(file_name, "rb");
-#else
- FILE *file = fopen(file_name, "rb");
-#endif
- if (!file) {
- printf("> Error loading .wasm!\n");
- goto quit;
- }
-
- int offset = fseek(file, 0L, SEEK_END);
- if (offset == -1) {
- printf("> Error loading .wasm!\n");
- goto close_file;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading .wasm!\n");
- goto close_file;
- }
-
- offset = fseek(file, 0L, SEEK_SET);
- if (offset == -1) {
- printf("> Error loading .wasm!\n");
- goto close_file;
- }
-
- wasm_byte_vec_new_uninitialized(out, file_size);
- if (fread(out->data, file_size, 1, file) != 1) {
- printf("> Error loading content!\n");
- goto close_file;
- }
-
- ret = true;
-close_file:
- fclose(file);
-quit:
- return ret;
-}
-
-static pthread_key_t name_key;
-
-wasm_trap_t *
-report_cb(const wasm_val_vec_t *args, wasm_val_vec_t *results)
-{
- (void)results;
-
- assert(args->data[0].kind == WASM_I32);
- uint32_t chk_pnt_no = args->data[0].of.i32;
-
- char *name = pthread_getspecific(name_key);
- printf("[%s] Pass CHK POINT #%u\n", name, chk_pnt_no);
-
- return NULL;
-}
-
-bool
-run_code_start(wasm_vm_t **out)
-{
- bool ret = false;
-
- printf("Initializing...\n");
- wasm_vm_t *vm = vm_new();
- if (!vm)
- goto fail;
-
- printf("Loading binary...\n");
- wasm_byte_vec_t binary = { 0 };
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- const char *file_name = "clone.aot";
-#else
- const char *file_name = "clone.wasm";
-#endif
- if (!load_wasm_file_content(file_name, &binary))
- goto release_vm;
-
- printf("Compiling module...\n");
- ret = vm_load(vm, &binary);
- wasm_byte_vec_delete(&binary);
- if (!ret)
- goto release_vm;
-
- printf("Creating callback...\n");
- wasm_functype_t *callback_type =
- wasm_functype_new_1_0(wasm_valtype_new_i32());
- if (!callback_type)
- goto release_vm;
-
- wasm_func_t *callback = wasm_func_new(vm->store, callback_type, report_cb);
- wasm_functype_delete(callback_type);
- if (!callback)
- goto release_vm;
-
- printf("Instantiating module...\n");
- wasm_extern_t *externs[] = { wasm_func_as_extern(callback) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- ret = vm_link(vm, &imports);
- wasm_func_delete(callback);
- if (!ret)
- goto release_vm;
-
- *out = vm;
- return true;
-
-release_vm:
- vm_release(vm);
-fail:
- return false;
-}
-
-bool
-run_warm_start_w_compiled_bytecode(const wasm_vm_t *first, wasm_vm_t **out)
-{
- bool ret;
- wasm_vm_t *secondary = vm_clone(first, compiled_bytecode);
- if (!secondary)
- goto fail;
-
- printf("Creating callback...\n");
- wasm_functype_t *callback_type =
- wasm_functype_new_1_0(wasm_valtype_new_i32());
- if (!callback_type)
- goto release_vm;
-
- wasm_func_t *callback =
- wasm_func_new(secondary->store, callback_type, report_cb);
- wasm_functype_delete(callback_type);
- if (!callback)
- goto release_vm;
-
- printf("Instantiating module...\n");
- wasm_extern_t *externs[] = { wasm_func_as_extern(callback) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- ret = vm_link(secondary, &imports);
- wasm_func_delete(callback);
- if (!ret)
- goto release_vm;
-
- *out = secondary;
- return true;
-
-release_vm:
- vm_release(secondary);
-fail:
- return false;
-}
-
-bool
-run_warm_start_w_instantiated_module(const wasm_vm_t *first, wasm_vm_t **out)
-{
- wasm_vm_t *secondary = vm_clone(first, instantiated_module);
- if (!secondary)
- return false;
-
- *out = secondary;
- return true;
-}
-
-void
-run_test(const wasm_vm_t *vm)
-{
- uint8_t byte = 0xFF;
-
- /* read initialization */
- vm_function_get_byte(vm, 10, &byte);
- assert(byte == 0x0);
- vm_memory_get_byte(vm, 10, &byte);
- assert(byte == 0x0);
-
- /* read after writing */
- vm_function_set_byte(vm, 16, 0xab);
- vm_function_get_byte(vm, 16, &byte);
- assert(byte == 0xab);
-
- vm_memory_set_byte(vm, 16, 0xcd);
- vm_memory_get_byte(vm, 16, &byte);
- assert(byte == 0xcd);
-
- /* reading and writing across */
- vm_function_set_byte(vm, 16, 0xef);
- vm_memory_get_byte(vm, 16, &byte);
- assert(byte == 0xef);
-
- vm_memory_set_byte(vm, 16, 0x67);
- vm_function_get_byte(vm, 16, &byte);
- assert(byte == 0x67);
-
- printf("All Passed ...\n");
-}
-
-static void *
-thrd_func(void *arg)
-{
- thread_arg_t *thrd_arg = (thread_arg_t *)arg;
-
- sleep(rand() % 5);
- printf("Running warm start at %s...\n", thrd_arg->name);
-
- pthread_setspecific(name_key, thrd_arg->name);
-
- wasm_vm_t *vm;
- if (!run_warm_start_w_compiled_bytecode(thrd_arg->base_vm, &vm))
- return NULL;
-
- pthread_mutex_trylock(thrd_arg->ready_go_lock);
- while (!(*thrd_arg->ready_go_flag)) {
- pthread_cond_wait(thrd_arg->ready_go_cond, thrd_arg->ready_go_lock);
- }
- pthread_mutex_unlock(thrd_arg->ready_go_lock);
-
- printf("Running test at %s...\n", thrd_arg->name);
- run_test(vm);
-
- vm_release(vm);
- pthread_exit(NULL);
- return NULL;
-}
-
-int
-main()
-{
- int ret = EXIT_FAILURE;
- bool ready_go_flag = false;
- pthread_mutex_t ready_go_lock = PTHREAD_MUTEX_INITIALIZER;
- pthread_cond_t ready_go_cond = PTHREAD_COND_INITIALIZER;
- pthread_key_create(&name_key, NULL);
- pthread_setspecific(name_key, "Execution Thread");
-
- printf("Running cold start at the execution thread...\n");
- wasm_vm_t *base_vm;
- if (!run_code_start(&base_vm))
- goto quit;
- run_test(base_vm);
-
- printf("Running warm start at other threads...\n");
-
- pthread_t tids[WORKER_NUMBER] = { 0 };
- thread_arg_t thrd_args[WORKER_NUMBER] = { 0 };
- for (size_t i = 0; i < sizeof(tids) / sizeof(tids[0]); i++) {
- thread_arg_t *thrd_arg = thrd_args + i;
-
- snprintf(thrd_arg->name, 32, "Worker#%lu", i);
- thrd_arg->ready_go_cond = &ready_go_cond;
- thrd_arg->ready_go_lock = &ready_go_lock;
- thrd_arg->ready_go_flag = &ready_go_flag;
- thrd_arg->base_vm = base_vm;
-
- int ret = pthread_create(&tids[i], NULL, thrd_func, thrd_arg);
- if (ret != 0)
- break;
- }
-
- sleep(1);
- pthread_mutex_trylock(&ready_go_lock);
- ready_go_flag = true;
- pthread_mutex_unlock(&ready_go_lock);
- pthread_cond_broadcast(&ready_go_cond);
-
- sleep(3);
- for (size_t i = 0; i < sizeof(tids) / sizeof(tids[0]); i++) {
- if (tids[i] != 0)
- pthread_join(tids[i], NULL);
- }
-
- vm_release(base_vm);
- ret = EXIT_SUCCESS;
-quit:
- return ret;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.wat
deleted file mode 100644
index e9934cc0d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/clone.wat
+++ /dev/null
@@ -1,15 +0,0 @@
-(module
- (func $report (import "" "report") (param i32))
-
- (memory (export "mem") 1 1)
-
- (func $wasm_set_byte (export "set_byte") (param i32 i32)
- (call $report (i32.const 1))
- (i32.store8 (local.get 0) (local.get 1))
- )
-
- (func $wasm_get_byte (export "get_byte") (param i32) (result i32)
- (call $report (i32.const 2))
- (i32.load(local.get 0))
- )
-) \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.c
deleted file mode 100644
index c8788b51a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.c
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <stdio.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("empty_imports.aot", "rb");
-#else
- FILE* file = fopen("empty_imports.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Instantiate with non-null but empty imports array.
- printf("Instantiating module...\n");
- wasm_extern_vec_t imports = WASM_EMPTY_VEC;
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- // Run an exported function to verify that the instance was created correctly.
- printf("Extracting export...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- return 1;
- }
-
- const wasm_func_t* add_func = wasm_extern_as_func(exports.data[0]);
- if (add_func == NULL) {
- printf("> Error accessing export!\n");
- return 1;
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
-
- printf("Calling export...\n");
- wasm_val_t args[2] = { WASM_I32_VAL(3), WASM_I32_VAL(4) };
- wasm_val_vec_t args_vec = WASM_ARRAY_VEC(args);
-
- wasm_val_t results[1] = { WASM_INIT_VAL };
- wasm_val_vec_t results_vec = WASM_ARRAY_VEC(results);
-
- wasm_trap_t *trap = wasm_func_call(add_func, &args_vec, &results_vec);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- return 1;
- }
-
- if (results_vec.data[0].of.i32 != 7) {
- printf("> Error calling function!\n");
- return 1;
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.wat
deleted file mode 100644
index 38639790b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/empty_imports.wat
+++ /dev/null
@@ -1,5 +0,0 @@
-(module
- (func (export "add") (param i32 i32) (result i32)
- (i32.add (local.get 0) (local.get 1))
- )
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.c
deleted file mode 100644
index 91c8cb654..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.c
+++ /dev/null
@@ -1,278 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-wasm_global_t* get_export_global(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_global(exports->data[i])) {
- printf("> Error accessing global export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_global(exports->data[i]);
-}
-
-wasm_func_t* get_export_func(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_func(exports->data[i])) {
- printf("> Error accessing function export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_func(exports->data[i]);
-}
-
-
-#define check(val, type, expected) \
- if (val.of.type != expected) { \
- printf("> Error reading value\n"); \
- exit(1); \
- }
-
-#define check_global(global, type, expected) \
- { \
- wasm_val_t val; \
- wasm_global_get(global, &val); \
- check(val, type, expected); \
- }
-
-#define check_trap(trap) \
- if (trap) { \
- printf("> Error calling function\n"); \
- wasm_trap_delete(trap); \
- exit(1); \
- }
-
-#define check_call(func, type, expected) \
- { \
- wasm_val_t vs[1]; \
- wasm_val_vec_t args = WASM_EMPTY_VEC; \
- wasm_val_vec_t results = WASM_ARRAY_VEC(vs); \
- wasm_trap_t *trap = wasm_func_call(func, &args, &results); \
- check_trap(trap); \
- check(vs[0], type, expected); \
- }
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("global.aot", "rb");
-#else
- FILE* file = fopen("global.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Create external globals.
- printf("Creating globals...\n");
- own wasm_globaltype_t* const_f32_type = wasm_globaltype_new(
- wasm_valtype_new(WASM_F32), WASM_CONST);
- own wasm_globaltype_t* const_i64_type = wasm_globaltype_new(
- wasm_valtype_new(WASM_I64), WASM_CONST);
- own wasm_globaltype_t* var_f32_type = wasm_globaltype_new(
- wasm_valtype_new(WASM_F32), WASM_VAR);
- own wasm_globaltype_t* var_i64_type = wasm_globaltype_new(
- wasm_valtype_new(WASM_I64), WASM_VAR);
-
- wasm_val_t val_f32_1 = WASM_F32_VAL(1);
- own wasm_global_t* const_f32_import =
- wasm_global_new(store, const_f32_type, &val_f32_1);
- wasm_val_t val_i64_2 = WASM_I64_VAL(2);
- own wasm_global_t* const_i64_import =
- wasm_global_new(store, const_i64_type, &val_i64_2);
- wasm_val_t val_f32_3 = WASM_F32_VAL(3);
- own wasm_global_t* var_f32_import =
- wasm_global_new(store, var_f32_type, &val_f32_3);
- wasm_val_t val_i64_4 = WASM_I64_VAL(4);
- own wasm_global_t* var_i64_import =
- wasm_global_new(store, var_i64_type, &val_i64_4);
-
- wasm_globaltype_delete(const_f32_type);
- wasm_globaltype_delete(const_i64_type);
- wasm_globaltype_delete(var_f32_type);
- wasm_globaltype_delete(var_i64_type);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_t* externs[] = {
- wasm_global_as_extern(const_f32_import),
- wasm_global_as_extern(const_i64_import),
- wasm_global_as_extern(var_f32_import),
- wasm_global_as_extern(var_i64_import)
- };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_module_delete(module);
-
- // Extract export.
- printf("Extracting exports...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- size_t i = 0;
- wasm_global_t* const_f32_export = get_export_global(&exports, i++);
- wasm_global_t* const_i64_export = get_export_global(&exports, i++);
- wasm_global_t* var_f32_export = get_export_global(&exports, i++);
- wasm_global_t* var_i64_export = get_export_global(&exports, i++);
- wasm_func_t* get_const_f32_import = get_export_func(&exports, i++);
- wasm_func_t* get_const_i64_import = get_export_func(&exports, i++);
- wasm_func_t* get_var_f32_import = get_export_func(&exports, i++);
- wasm_func_t* get_var_i64_import = get_export_func(&exports, i++);
- wasm_func_t* get_const_f32_export = get_export_func(&exports, i++);
- wasm_func_t* get_const_i64_export = get_export_func(&exports, i++);
- wasm_func_t* get_var_f32_export = get_export_func(&exports, i++);
- wasm_func_t* get_var_i64_export = get_export_func(&exports, i++);
- wasm_func_t* set_var_f32_import = get_export_func(&exports, i++);
- wasm_func_t* set_var_i64_import = get_export_func(&exports, i++);
- wasm_func_t* set_var_f32_export = get_export_func(&exports, i++);
- wasm_func_t* set_var_i64_export = get_export_func(&exports, i++);
-
- // Try cloning.
- own wasm_global_t* copy = wasm_global_copy(var_f32_import);
- assert(wasm_global_same(var_f32_import, copy));
- wasm_global_delete(copy);
-
- // Interact.
- printf("Accessing globals...\n");
-
- // Check initial values.
- check_global(const_f32_import, f32, 1);
- check_global(const_i64_import, i64, 2);
- check_global(var_f32_import, f32, 3);
- check_global(var_i64_import, i64, 4);
- check_global(const_f32_export, f32, 5);
- check_global(const_i64_export, i64, 6);
- check_global(var_f32_export, f32, 7);
- check_global(var_i64_export, i64, 8);
-
- check_call(get_const_f32_import, f32, 1);
- check_call(get_const_i64_import, i64, 2);
- check_call(get_var_f32_import, f32, 3);
- check_call(get_var_i64_import, i64, 4);
- check_call(get_const_f32_export, f32, 5);
- check_call(get_const_i64_export, i64, 6);
- check_call(get_var_f32_export, f32, 7);
- check_call(get_var_i64_export, i64, 8);
-
- // Modify variables through API and check again.
- wasm_val_t val33 = WASM_F32_VAL(33);
- wasm_global_set(var_f32_import, &val33);
- wasm_val_t val34 = WASM_I64_VAL(34);
- wasm_global_set(var_i64_import, &val34);
- wasm_val_t val37 = WASM_F32_VAL(37);
- wasm_global_set(var_f32_export, &val37);
- wasm_val_t val38 = WASM_I64_VAL(38);
- wasm_global_set(var_i64_export, &val38);
-
- check_global(var_f32_import, f32, 33);
- check_global(var_i64_import, i64, 34);
- check_global(var_f32_export, f32, 37);
- check_global(var_i64_export, i64, 38);
-
- check_call(get_var_f32_import, f32, 33);
- check_call(get_var_i64_import, i64, 34);
- check_call(get_var_f32_export, f32, 37);
- check_call(get_var_i64_export, i64, 38);
-
- // Modify variables through calls and check again.
- wasm_val_vec_t res = WASM_EMPTY_VEC;
- wasm_val_t vs73[] = { WASM_F32_VAL(73) };
- wasm_val_vec_t args73 = WASM_ARRAY_VEC(vs73);
- wasm_trap_t *trap = wasm_func_call(set_var_f32_import, &args73, &res);
- check_trap(trap);
-
- wasm_val_t vs74[] = { WASM_I64_VAL(74) };
- wasm_val_vec_t args74 = WASM_ARRAY_VEC(vs74);
- trap = wasm_func_call(set_var_i64_import, &args74, &res);
- check_trap(trap);
-
- wasm_val_t vs77[] = { WASM_F32_VAL(77) };
- wasm_val_vec_t args77 = WASM_ARRAY_VEC(vs77);
- trap = wasm_func_call(set_var_f32_export, &args77, &res);
- check_trap(trap);
-
- wasm_val_t vs78[] = { WASM_I64_VAL(78) };
- wasm_val_vec_t args78 = WASM_ARRAY_VEC(vs78);
- trap = wasm_func_call(set_var_i64_export, &args78, &res);
- check_trap(trap);
-
- check_global(var_f32_import, f32, 73);
- check_global(var_i64_import, i64, 74);
- check_global(var_f32_export, f32, 77);
- check_global(var_i64_export, i64, 78);
-
- check_call(get_var_f32_import, f32, 73);
- check_call(get_var_i64_import, i64, 74);
- check_call(get_var_f32_export, f32, 77);
- check_call(get_var_i64_export, i64, 78);
-
- wasm_global_delete(const_f32_import);
- wasm_global_delete(const_i64_import);
- wasm_global_delete(var_f32_import);
- wasm_global_delete(var_i64_import);
- wasm_extern_vec_delete(&exports);
- wasm_instance_delete(instance);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.wat
deleted file mode 100644
index dea085772..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/global.wat
+++ /dev/null
@@ -1,27 +0,0 @@
-(module
- (global $f32_import (import "" "const f32") f32)
- (global $i64_import (import "" "const i64") i64)
- (global $mut_f32_import (import "" "var f32") (mut f32))
- (global $mut_i64_import (import "" "var i64") (mut i64))
-
- (global $f32_export (export "const f32") f32 (f32.const 5))
- (global $i64_export (export "const i64") i64 (i64.const 6))
- (global $mut_f32_export (export "var f32") (mut f32) (f32.const 7))
- (global $mut_i64_export (export "var i64") (mut i64) (i64.const 8))
-
- (func (export "get const f32 import") (result f32) (global.get $f32_import))
- (func (export "get const i64 import") (result i64) (global.get $i64_import))
- (func (export "get var f32 import") (result f32) (global.get $mut_f32_import))
- (func (export "get var i64 import") (result i64) (global.get $mut_i64_import))
-
- (func (export "get const f32 export") (result f32) (global.get $f32_export))
- (func (export "get const i64 export") (result i64) (global.get $i64_export))
- (func (export "get var f32 export") (result f32) (global.get $mut_f32_export))
- (func (export "get var i64 export") (result i64) (global.get $mut_i64_export))
-
- (func (export "set var f32 import") (param f32) (global.set $mut_f32_import (local.get 0)))
- (func (export "set var i64 import") (param i64) (global.set $mut_i64_import (local.get 0)))
-
- (func (export "set var f32 export") (param f32) (global.set $mut_f32_export (local.get 0)))
- (func (export "set var f64 export") (param i64) (global.set $mut_i64_export (local.get 0)))
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-0.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-0.wat
deleted file mode 100644
index 7ab897c73..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-0.wat
+++ /dev/null
@@ -1,8 +0,0 @@
-;; Copyright (C) 2019 Intel Corporation. All rights reserved.
-;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-(module
- (global $mut_f32_export (export "var f32") (mut f32) (f32.const 7))
- (func (export "get var f32 export") (result f32) (global.get $mut_f32_export))
- (func (export "set var f32 export") (param f32) (global.set $mut_f32_export (local.get 0)))
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-1.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-1.wat
deleted file mode 100644
index 927e420d7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport-1.wat
+++ /dev/null
@@ -1,10 +0,0 @@
-;; Copyright (C) 2019 Intel Corporation. All rights reserved.
-;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-(module
- (global $mut_f32_import (export "var f32") (import "globalexportimport-0" "var f32") (mut f32))
- (func (export "get var f32 export") (import "globalexportimport-0" "get var f32 export") (result f32))
- (func (export "set var f32 export") (import "globalexportimport-0" "set var f32 export") (param f32))
- (func (export "get var f32 import") (result f32) (global.get $mut_f32_import))
- (func (export "set var f32 import") (param f32) (global.set $mut_f32_import (local.get 0)))
-) \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport.c
deleted file mode 100644
index 1c1715f2e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/globalexportimport.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-#include "wasm_export.h"
-#include "bh_platform.h"
-
-extern bool
-reader(const char *module_name, uint8 **p_buffer, uint32 *p_size);
-
-extern void
-destroyer(uint8 *buffer, uint32 size);
-
-#define own
-
-wasm_global_t* get_export_global(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_global(exports->data[i])) {
- printf("> Error accessing global export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_global(exports->data[i]);
-}
-
-wasm_func_t* get_export_func(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_func(exports->data[i])) {
- printf("> Error accessing function export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_func(exports->data[i]);
-}
-
-
-#define check(val, type, expected) \
- if (val.of.type != expected) { \
- printf("> Expected reading value %f or %f \n", expected, expected); \
- printf("> Error reading value %f or %f\n", val.of.type, val.of.type); \
- }
-
-#define check_global(global, type, expected) \
- { \
- wasm_val_t val; \
- wasm_global_get(global, &val); \
- check(val, type, expected); \
- }
-
-#define check_trap(trap) \
- if (trap) { \
- printf("> Error calling function\n"); \
- wasm_trap_delete(trap); \
- exit(1); \
- }
-
-#define check_call(func, type, expected) \
- { \
- wasm_val_vec_t results; \
- wasm_val_vec_new_uninitialized(&results, 1); \
- wasm_trap_t *trap = wasm_func_call(func, NULL, &results); \
- check_trap(trap); \
- check(results.data[0], type, expected); \
- }
-
-wasm_module_t * create_module_from_file(wasm_store_t* store, const char * filename)
-{
- FILE* file = fopen(filename, "rb");
- fseek(file, 0L, SEEK_END);
- size_t file_size = ftell(file);
- fseek(file, 0L, SEEK_SET);
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return NULL;
- }
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return NULL;
- }
- wasm_byte_vec_delete(&binary);
- fclose(file);
- return module;
-}
-
-
-int main(int argc, const char* argv[]) {
- wasm_runtime_set_module_reader(reader, destroyer);
-
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- wasm_module_t* moduleimport =
- create_module_from_file(store, "globalimport.aot");
-#else
- wasm_module_t* moduleimport =
- create_module_from_file(store, "globalexportimport-1.wasm");
-#endif
-
- if (!moduleimport) {
- return 1;
- }
-
- // Instantiate.
- printf("Instantiating Import module...\n");
- own wasm_instance_t* instance_import =
- wasm_instance_new(store, moduleimport, NULL, NULL); //after this var_f32_export->inst_comm_rt is module_import
- if (!instance_import) {
- printf("> Error instantiating Import module!\n");
- return 1;
- }
- wasm_module_delete(moduleimport);
-
- // Extract export.
- printf("Extracting exports from Import module...\n");
- own wasm_extern_vec_t exports_of_import;
- wasm_instance_exports(instance_import, &exports_of_import);
- int i = 0;
- wasm_global_t *var_f32_export = get_export_global(&exports_of_import, i++);
- wasm_func_t *get_var_f32_export = get_export_func(&exports_of_import, i++);
- wasm_func_t* set_var_f32_export = get_export_func(&exports_of_import, i++);
- wasm_func_t* get_var_f32_import = get_export_func(&exports_of_import, i++);
- wasm_func_t* set_var_f32_import = get_export_func(&exports_of_import, i++);
-
- // Interact.
-
- // Check initial values.
- printf("Check initial values...\n");
- check_global(var_f32_export, f32, 7.0);
- check_call(get_var_f32_export, f32, 7.0); //Call to module export
- check_call(get_var_f32_import, f32, 7.0); //Call to module import
-
-
- // Modify variables through API and check again.
- printf("Modify the variable to 37.0...\n");
- wasm_val_t val37 = {.kind = WASM_F32, .of = {.f32 = 37.0}};
- wasm_global_set(var_f32_export, &val37); // var_f32_export->inst_comm_rt is module_import now
-
- check_global(var_f32_export, f32, 37.0);
- check_call(get_var_f32_export, f32, 37.0); //Call to module export Failed here, still 7
- check_call(get_var_f32_import, f32, 37.0); //Call to module import
-
- // Modify variables through calls and check again.
- printf("Modify the variable to 77.0...\n");
- wasm_val_vec_t args77;
- wasm_val_vec_new(&args77, 1, (wasm_val_t []){ {.kind = WASM_F32, .of = {.f32 = 77.0}} });
- wasm_trap_t *trap = wasm_func_call(set_var_f32_export, &args77,
- NULL); // Call to module export
- check_trap(trap);
- check_call(get_var_f32_export, f32, 77.0); //Call to module export
- check_global(var_f32_export, f32, 77.0); //Failed here, still 37
- check_call(get_var_f32_import, f32, 77.0); //Call to module import Failed here, still 37
-
-
- printf("Modify the variable to 78.0...\n");
- wasm_val_vec_t args78;
- wasm_val_vec_new(&args78, 1, (wasm_val_t []){ {.kind = WASM_F32, .of = {.f32 = 78.0}} });
- trap = wasm_func_call(set_var_f32_import, &args78, NULL);
- check_trap(trap);
- check_global(var_f32_export, f32, 78.0);
- check_call(get_var_f32_export, f32, 78.0); //Call to module export Failed here, still 77
- check_call(get_var_f32_import, f32, 78.0); //Call to module import
-
-
- // wasm_extern_vec_delete(&exports_of_export);
- //wasm_instance_delete(instance_export);
- wasm_extern_vec_delete(&exports_of_import);
- //wasm_instance_delete(instance_import);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.c
deleted file mode 100644
index 3ebea87b0..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.c
+++ /dev/null
@@ -1,138 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-// A function to be called from Wasm code.
-own wasm_trap_t* hello_callback(
- const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- printf("Calling back...\n");
- printf("> Hello World!\n");
- return NULL;
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("hello.aot", "rb");
-#else
- FILE* file = fopen("hello.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Create external print functions.
- printf("Creating callback...\n");
- own wasm_functype_t* hello_type = wasm_functype_new_0_0();
- own wasm_func_t* hello_func =
- wasm_func_new(store, hello_type, hello_callback);
-
- wasm_functype_delete(hello_type);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_t* externs[] = { wasm_func_as_extern(hello_func) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_func_delete(hello_func);
-
- // Extract export.
- printf("Extracting export...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- return 1;
- }
-
- const wasm_func_t* run_func = wasm_extern_as_func(exports.data[0]);
- if (run_func == NULL) {
- printf("> Error accessing export!\n");
- return 1;
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
-
- // Call.
- printf("Calling export...\n");
- wasm_val_vec_t args = WASM_EMPTY_VEC;
- wasm_val_vec_t results = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(run_func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- return 1;
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.wat
deleted file mode 100644
index 1c56c5582..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hello.wat
+++ /dev/null
@@ -1,4 +0,0 @@
-(module
- (func $hello (import "" "hello"))
- (func (export "run") (call $hello))
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.c
deleted file mode 100644
index 219c862d6..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.c
+++ /dev/null
@@ -1,308 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-
-// A function to be called from Wasm code.
-own wasm_trap_t* callback(
- const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- printf("Calling back...\n> ");
- printf("> %p\n",
- args->data[0].of.ref ? wasm_ref_get_host_info(args->data[0].of.ref) : NULL);
- wasm_val_copy(&results->data[0], &args->data[0]);
- return NULL;
-}
-
-
-wasm_func_t* get_export_func(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_func(exports->data[i])) {
- printf("> Error accessing function export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_func(exports->data[i]);
-}
-
-wasm_global_t* get_export_global(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_global(exports->data[i])) {
- printf("> Error accessing global export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_global(exports->data[i]);
-}
-
-wasm_table_t* get_export_table(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_table(exports->data[i])) {
- printf("> Error accessing table export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_table(exports->data[i]);
-}
-
-
-own wasm_ref_t* call_v_r(const wasm_func_t* func) {
- printf("call_v_r... "); fflush(stdout);
- wasm_val_t rs[] = { WASM_INIT_VAL };
- wasm_val_vec_t args = WASM_EMPTY_VEC;
- wasm_val_vec_t results = WASM_ARRAY_VEC(rs);
- wasm_trap_t *trap = wasm_func_call(func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- exit(1);
- }
- printf("okay\n");
- return rs[0].of.ref;
-}
-
-void call_r_v(const wasm_func_t* func, wasm_ref_t* ref) {
- printf("call_r_v... "); fflush(stdout);
- wasm_val_t vs[1] = { WASM_REF_VAL(ref) };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
- wasm_val_vec_t results = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- exit(1);
- }
- printf("okay\n");
-}
-
-own wasm_ref_t* call_r_r(const wasm_func_t* func, wasm_ref_t* ref) {
- printf("call_r_r... "); fflush(stdout);
- wasm_val_t vs[1] = { WASM_REF_VAL(ref) };
- wasm_val_t rs[1] = { WASM_INIT_VAL };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
- wasm_val_vec_t results = WASM_ARRAY_VEC(rs);
- wasm_trap_t *trap = wasm_func_call(func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- exit(1);
- }
- printf("okay\n");
- return rs[0].of.ref;
-}
-
-void call_ir_v(const wasm_func_t* func, int32_t i, wasm_ref_t* ref) {
- printf("call_ir_v... "); fflush(stdout);
- wasm_val_t vs[2] = { WASM_I32_VAL(i), WASM_REF_VAL(ref) };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
- wasm_val_vec_t results = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- exit(1);
- }
- printf("okay\n");
-}
-
-own wasm_ref_t* call_i_r(const wasm_func_t* func, int32_t i) {
- printf("call_i_r... "); fflush(stdout);
- wasm_val_t vs[1] = { WASM_I32_VAL(i) };
- wasm_val_t rs[1] = { WASM_INIT_VAL };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
- wasm_val_vec_t results = WASM_ARRAY_VEC(rs);
- wasm_trap_t *trap = wasm_func_call(func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- exit(1);
- }
- printf("okay\n");
- return rs[0].of.ref;
-}
-
-void check(own wasm_ref_t* actual, const wasm_ref_t* expected) {
- if (actual != expected &&
- !(actual && expected && wasm_ref_same(actual, expected))) {
- printf("> Error reading reference, expected %p, got %p\n",
- expected ? wasm_ref_get_host_info(expected) : NULL,
- actual ? wasm_ref_get_host_info(actual) : NULL);
- exit(1);
- }
- // if (actual) wasm_ref_delete(actual);
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("hostref.aot", "rb");
-#else
- FILE* file = fopen("hostref.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Create external callback function.
- printf("Creating callback...\n");
- own wasm_functype_t* callback_type = wasm_functype_new_1_1(
- wasm_valtype_new(WASM_ANYREF), wasm_valtype_new(WASM_ANYREF));
- own wasm_func_t* callback_func =
- wasm_func_new(store, callback_type, callback);
-
- wasm_functype_delete(callback_type);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_t* externs[] = { wasm_func_as_extern(callback_func) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_func_delete(callback_func);
- wasm_module_delete(module);
-
- // Extract export.
- printf("Extracting exports...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- size_t i = 0;
- wasm_global_t* global = get_export_global(&exports, i++);
- wasm_table_t* table = get_export_table(&exports, i++);
- wasm_func_t* global_set = get_export_func(&exports, i++);
- wasm_func_t* global_get = get_export_func(&exports, i++);
- wasm_func_t* table_set = get_export_func(&exports, i++);
- wasm_func_t* table_get = get_export_func(&exports, i++);
- wasm_func_t* func_call = get_export_func(&exports, i++);
-
- wasm_instance_delete(instance);
-
- // Create host references.
- printf("Creating host references...\n");
- own wasm_ref_t* host1 = wasm_foreign_as_ref(wasm_foreign_new(store));
- own wasm_ref_t* host2 = wasm_foreign_as_ref(wasm_foreign_new(store));
- wasm_ref_set_host_info(host1, (void*)1);
- wasm_ref_set_host_info(host2, (void*)2);
-
- // Some sanity checks.
- check(NULL, NULL);
- wasm_ref_t *host1_cp = wasm_ref_copy(host1);
- wasm_ref_t *host2_cp = wasm_ref_copy(host2);
- check(host1_cp, host1);
- check(host2_cp, host2);
- wasm_ref_delete(host1_cp);
- wasm_ref_delete(host2_cp);
-
- own wasm_val_t val;
- val.kind = WASM_ANYREF;
- val.of.ref = wasm_ref_copy(host1);
- wasm_ref_t *ref_cp = wasm_ref_copy(val.of.ref);
- check(ref_cp, host1);
- check(val.of.ref, host1);
- wasm_ref_delete(val.of.ref);
- wasm_ref_delete(ref_cp);
-
- // Interact.
- printf("Accessing global...\n");
- check(call_v_r(global_get), NULL);
- call_r_v(global_set, host1);
- check(call_v_r(global_get), host1);
- call_r_v(global_set, host2);
- check(call_v_r(global_get), host2);
- call_r_v(global_set, NULL);
- check(call_v_r(global_get), NULL);
-
- wasm_global_get(global, &val);
- assert(val.kind == WASM_ANYREF);
- assert(val.of.ref == NULL);
- val.of.ref = host2;
- wasm_global_set(global, &val);
- wasm_global_get(global, &val);
- assert(val.kind == WASM_ANYREF);
- assert(val.of.ref == host2);
-
- printf("Accessing table...\n");
- check(call_i_r(table_get, 0), NULL);
- check(call_i_r(table_get, 1), NULL);
- call_ir_v(table_set, 0, host1);
- call_ir_v(table_set, 1, host2);
- check(call_i_r(table_get, 0), host1);
- check(call_i_r(table_get, 1), host2);
- call_ir_v(table_set, 0, NULL);
- check(call_i_r(table_get, 0), NULL);
-
- check(wasm_table_get(table, 2), NULL);
- wasm_table_set(table, 2, host1);
- check(call_i_r(table_get, 2), host1);
- check(wasm_table_get(table, 2), host1);
-
- printf("Accessing function...\n");
- check(call_r_r(func_call, NULL), NULL);
- check(call_r_r(func_call, host1), host1);
- check(call_r_r(func_call, host2), host2);
-
- wasm_ref_delete(host1);
- wasm_ref_delete(host2);
-
- wasm_extern_vec_delete(&exports);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.wat
deleted file mode 100644
index 9ed43dbcb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/hostref.wat
+++ /dev/null
@@ -1,24 +0,0 @@
-(module
- (import "" "f" (func $fun (param externref) (result externref)))
-
- (global $glob (export "global") (mut externref) (ref.null extern))
- (table $tab (export "table") 10 externref)
-
- (func (export "global.set") (param $r externref)
- (global.set $glob (local.get $r))
- )
- (func (export "global.get") (result externref)
- (global.get $glob)
- )
-
- (func (export "table.set") (param $i i32) (param $r externref)
- (table.set $tab (local.get $i) (local.get $r))
- )
- (func (export "table.get") (param $i i32) (result externref)
- (table.get $tab (local.get $i))
- )
-
- (func (export "func.call") (param $r externref) (result externref)
- (call $fun (local.get $r))
- )
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.c
deleted file mode 100644
index 737dd8501..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.c
+++ /dev/null
@@ -1,235 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-
-wasm_memory_t* get_export_memory(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_memory(exports->data[i])) {
- printf("> Error accessing memory export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_memory(exports->data[i]);
-}
-
-wasm_func_t* get_export_func(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_func(exports->data[i])) {
- printf("> Error accessing function export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_func(exports->data[i]);
-}
-
-
-void check(bool success) {
- if (!success) {
- printf("> Error, expected success\n");
- exit(1);
- }
-}
-
-void check_call(wasm_func_t* func, int i, wasm_val_t args[], int32_t expected) {
- wasm_val_t r[] = {WASM_INIT_VAL};
- wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t), NULL};
- wasm_val_vec_t results = WASM_ARRAY_VEC(r);
- wasm_trap_t *trap = wasm_func_call(func, &args_, &results);
- if (trap) {
- printf("> Error on result\n");
- wasm_trap_delete(trap);
- exit(1);
- }
-
- if (r[0].of.i32 != expected) {
- printf("> Error on result\n");
- exit(1);
- }
-}
-
-void check_call0(wasm_func_t* func, int32_t expected) {
- check_call(func, 0, NULL, expected);
-}
-
-void check_call1(wasm_func_t* func, int32_t arg, int32_t expected) {
- wasm_val_t args[] = { WASM_I32_VAL(arg) };
- check_call(func, 1, args, expected);
-}
-
-void check_call2(wasm_func_t* func, int32_t arg1, int32_t arg2, int32_t expected) {
- wasm_val_t args[] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };
- check_call(func, 2, args, expected);
-}
-
-void check_ok(wasm_func_t* func, int i, wasm_val_t args[]) {
- wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t), NULL};
- wasm_val_vec_t results = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(func, &args_, &results);
- if (trap) {
- printf("> Error on result, expected empty\n");
- wasm_trap_delete(trap);
- exit(1);
- }
-}
-
-void check_ok2(wasm_func_t* func, int32_t arg1, int32_t arg2) {
- wasm_val_t args[] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };
- check_ok(func, 2, args);
-}
-
-void check_trap(wasm_func_t* func, int i, wasm_val_t args[]) {
- wasm_val_t r[] = {WASM_INIT_VAL};
- wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t), NULL};
- wasm_val_vec_t results = WASM_ARRAY_VEC(r);
- own wasm_trap_t* trap = wasm_func_call(func, &args_, &results);
- if (! trap) {
- printf("> Error on result, expected trap\n");
- exit(1);
- }
- wasm_trap_delete(trap);
-}
-
-void check_trap1(wasm_func_t* func, int32_t arg) {
- wasm_val_t args[] = { WASM_I32_VAL(arg) };
- check_trap(func, 1, args);
-}
-
-void check_trap2(wasm_func_t* func, int32_t arg1, int32_t arg2) {
- wasm_val_t args[] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };
- check_trap(func, 2, args);
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("memory.aot", "rb");
-#else
- FILE* file = fopen("memory.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_vec_t imports = WASM_EMPTY_VEC;
- own wasm_instance_t *instance = wasm_instance_new_with_args(
- store, module, &imports, NULL, KILOBYTE(32), 0);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- // Extract export.
- printf("Extracting exports...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- size_t i = 0;
- wasm_memory_t* memory = get_export_memory(&exports, i++);
- wasm_func_t* size_func = get_export_func(&exports, i++);
- wasm_func_t* load_func = get_export_func(&exports, i++);
- wasm_func_t* store_func = get_export_func(&exports, i++);
-
- wasm_module_delete(module);
-
- // Try cloning.
- own wasm_memory_t* copy = wasm_memory_copy(memory);
- assert(wasm_memory_same(memory, copy));
- wasm_memory_delete(copy);
-
- // Check initial memory.
- printf("Checking memory...\n");
- check(wasm_memory_size(memory) == 2);
- check(wasm_memory_data_size(memory) == 0x20000);
- check(wasm_memory_data(memory)[0] == 0);
- check(wasm_memory_data(memory)[0x1000] == 1);
- check(wasm_memory_data(memory)[0x1003] == 4);
-
- check_call0(size_func, 2);
- check_call1(load_func, 0, 0);
- check_call1(load_func, 0x1000, 1);
- check_call1(load_func, 0x1003, 4);
- check_call1(load_func, 0x1ffff, 0);
- check_trap1(load_func, 0x20000);
-
- // Mutate memory.
- printf("Mutating memory...\n");
- wasm_memory_data(memory)[0x1003] = 5;
- check_ok2(store_func, 0x1002, 6);
- check_trap2(store_func, 0x20000, 0);
-
- check(wasm_memory_data(memory)[0x1002] == 6);
- check(wasm_memory_data(memory)[0x1003] == 5);
- check_call1(load_func, 0x1002, 6);
- check_call1(load_func, 0x1003, 5);
-
- // Grow memory.
- // DO NOT SUPPORT
- printf("Bypass Growing memory...\n");
- wasm_extern_vec_delete(&exports);
- wasm_instance_delete(instance);
-
- // Create stand-alone memory.
- // DO NOT SUPPORT
- // TODO(wasm+): Once Wasm allows multiple memories, turn this into import.
- printf("Bypass Creating stand-alone memory...\n");
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.wat
deleted file mode 100644
index 4cf43e2c7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/memory.wat
+++ /dev/null
@@ -1,11 +0,0 @@
-(module
- (memory (export "memory") 2 3)
-
- (func (export "size") (result i32) (memory.size))
- (func (export "load") (param i32) (result i32) (i32.load8_s (local.get 0)))
- (func (export "store") (param i32 i32)
- (i32.store8 (local.get 0) (local.get 1))
- )
-
- (data (i32.const 0x1000) "\01\02\03\04")
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.c
deleted file mode 100644
index a1c8fa9fc..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.c
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-// A function to be called from Wasm code.
-own wasm_trap_t* callback(
- const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- printf("Calling back...\n> ");
- printf("> %"PRIu32" %"PRIu64" %"PRIu64" %"PRIu32"\n",
- args->data[0].of.i32, args->data[1].of.i64,
- args->data[2].of.i64, args->data[3].of.i32);
- printf("\n");
-
- wasm_val_copy(&results->data[0], &args->data[3]);
- wasm_val_copy(&results->data[1], &args->data[1]);
- wasm_val_copy(&results->data[2], &args->data[2]);
- wasm_val_copy(&results->data[3], &args->data[0]);
- return NULL;
-}
-
-
-// A function closure.
-own wasm_trap_t* closure_callback(
- void* env, const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- int i = *(int*)env;
- printf("Calling back closure...\n");
- printf("> %d\n", i);
-
- results->data[0].kind = WASM_I32;
- results->data[0].of.i32 = (int32_t)i;
- return NULL;
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("multi.aot", "rb");
-#else
- FILE* file = fopen("multi.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
- fseek(file, 0L, SEEK_END);
- size_t file_size = ftell(file);
- fseek(file, 0L, SEEK_SET);
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Create external print functions.
- printf("Creating callback...\n");
- wasm_valtype_t* types[4] = {
- wasm_valtype_new_i32(), wasm_valtype_new_i64(),
- wasm_valtype_new_i64(), wasm_valtype_new_i32()
- };
- own wasm_valtype_vec_t tuple1, tuple2;
- wasm_valtype_vec_new(&tuple1, 4, types);
- wasm_valtype_vec_copy(&tuple2, &tuple1);
- own wasm_functype_t* callback_type = wasm_functype_new(&tuple1, &tuple2);
- own wasm_func_t* callback_func =
- wasm_func_new(store, callback_type, callback);
-
- wasm_functype_delete(callback_type);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_t* externs[] = { wasm_func_as_extern(callback_func) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_func_delete(callback_func);
-
- // Extract export.
- printf("Extracting export...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- return 1;
- }
- const wasm_func_t* run_func = wasm_extern_as_func(exports.data[0]);
- if (run_func == NULL) {
- printf("> Error accessing export!\n");
- return 1;
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
-
- // Call.
- printf("Calling export...\n");
- wasm_val_t vals[4] = {
- WASM_I32_VAL(1), WASM_I64_VAL(2), WASM_I64_VAL(3), WASM_I32_VAL(4)
- };
- wasm_val_t res[4] = {
- WASM_INIT_VAL, WASM_INIT_VAL, WASM_INIT_VAL, WASM_INIT_VAL
- };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vals);
- wasm_val_vec_t results = WASM_ARRAY_VEC(res);
- wasm_trap_t *trap = wasm_func_call(run_func, &args, &results);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- return 1;
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Print result.
- printf("Printing result...\n");
- printf("> %"PRIu32" %"PRIu64" %"PRIu64" %"PRIu32"\n",
- res[0].of.i32, res[1].of.i64, res[2].of.i64, res[3].of.i32);
-
- assert(res[0].of.i32 == 4);
- assert(res[1].of.i64 == 3);
- assert(res[2].of.i64 == 2);
- assert(res[3].of.i32 == 1);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.wat
deleted file mode 100644
index e7fb33112..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/multi.wat
+++ /dev/null
@@ -1,7 +0,0 @@
-(module
- (func $f (import "" "f") (param i32 i64 i64 i32) (result i32 i64 i64 i32))
-
- (func $g (export "g") (param i32 i64 i64 i32) (result i32 i64 i64 i32)
- (call $f (local.get 0) (local.get 2) (local.get 1) (local.get 3))
- )
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.c
deleted file mode 100644
index a595fd3e0..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.c
+++ /dev/null
@@ -1,207 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-void print_mutability(wasm_mutability_t mut) {
- switch (mut) {
- case WASM_VAR: printf("var"); break;
- case WASM_CONST: printf("const"); break;
- }
-}
-
-void print_limits(const wasm_limits_t* limits) {
- if (!limits) {
- printf("unknown limits");
- return;
- }
- printf("%ud", limits->min);
- if (limits->max < wasm_limits_max_default) printf(" %ud", limits->max);
-}
-
-void print_valtype(const wasm_valtype_t* type) {
- switch (wasm_valtype_kind(type)) {
- case WASM_I32: printf("i32"); break;
- case WASM_I64: printf("i64"); break;
- case WASM_F32: printf("f32"); break;
- case WASM_F64: printf("f64"); break;
- case WASM_ANYREF: printf("anyref"); break;
- case WASM_FUNCREF: printf("funcref"); break;
- }
-}
-
-void print_valtypes(const wasm_valtype_vec_t* types) {
- bool first = true;
- for (size_t i = 0; i < types->size; ++i) {
- if (first) {
- first = false;
- } else {
- printf(" ");
- }
- print_valtype(types->data[i]);
- }
-}
-
-void print_externtype(const wasm_externtype_t* type) {
- if (!type) {
- printf("unknown extern type");
- return;
- }
- switch (wasm_externtype_kind(type)) {
- case WASM_EXTERN_FUNC: {
- const wasm_functype_t* functype =
- wasm_externtype_as_functype_const(type);
- printf("func ");
- print_valtypes(wasm_functype_params(functype));
- printf(" -> ");
- print_valtypes(wasm_functype_results(functype));
- } break;
- case WASM_EXTERN_GLOBAL: {
- const wasm_globaltype_t* globaltype =
- wasm_externtype_as_globaltype_const(type);
- printf("global ");
- print_mutability(wasm_globaltype_mutability(globaltype));
- printf(" ");
- print_valtype(wasm_globaltype_content(globaltype));
- } break;
- case WASM_EXTERN_TABLE: {
- const wasm_tabletype_t* tabletype =
- wasm_externtype_as_tabletype_const(type);
- printf("table ");
- print_limits(wasm_tabletype_limits(tabletype));
- printf(" ");
- print_valtype(wasm_tabletype_element(tabletype));
- } break;
- case WASM_EXTERN_MEMORY: {
- const wasm_memorytype_t* memorytype =
- wasm_externtype_as_memorytype_const(type);
- printf("memory ");
- print_limits(wasm_memorytype_limits(memorytype));
- } break;
- }
-}
-
-void print_name(const wasm_name_t* name) {
- if (!name) {
- printf("unknown name");
- return;
- }
- printf("\"%.*s\"", (int)name->size, name->data);
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("reflect.aot", "rb");
-#else
- FILE* file = fopen("reflect.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_vec_t imports = WASM_EMPTY_VEC;
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- // Extract export.
- printf("Extracting export...\n");
- own wasm_exporttype_vec_t export_types;
- own wasm_extern_vec_t exports;
- wasm_module_exports(module, &export_types);
- wasm_instance_exports(instance, &exports);
- assert(exports.size == export_types.size);
-
- for (size_t i = 0; i < exports.size; ++i) {
- assert(wasm_extern_kind(exports.data[i]) ==
- wasm_externtype_kind(wasm_exporttype_type(export_types.data[i])));
- printf("> export %zu ", i);
- print_name(wasm_exporttype_name(export_types.data[i]));
- printf("\n");
- printf(">> initial: ");
- print_externtype(wasm_exporttype_type(export_types.data[i]));
- printf("\n");
- printf(">> current: ");
- own wasm_externtype_t* current = wasm_extern_type(exports.data[i]);
- print_externtype(current);
- wasm_externtype_delete(current);
- printf("\n");
- if (wasm_extern_kind(exports.data[i]) == WASM_EXTERN_FUNC) {
- wasm_func_t* func = wasm_extern_as_func(exports.data[i]);
- printf(">> in-arity: %zu", wasm_func_param_arity(func));
- printf(", out-arity: %zu\n", wasm_func_result_arity(func));
- }
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
- wasm_extern_vec_delete(&exports);
- wasm_exporttype_vec_delete(&export_types);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.wat
deleted file mode 100644
index 7a80e86dd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/reflect.wat
+++ /dev/null
@@ -1,6 +0,0 @@
-(module
- (func (export "func") (param i32 f64 f32) (result i32) (unreachable))
- (global (export "global") f64 (f64.const 0))
- (table (export "table") 0 50 funcref)
- (memory (export "memory") 1)
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.c
deleted file mode 100644
index 83436817f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.c
+++ /dev/null
@@ -1,131 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-// A function to be called from Wasm code.
-own wasm_trap_t *
-hello_callback(const wasm_val_vec_t *args, wasm_val_vec_t *results)
-{
- printf("Calling back...\n");
- printf("> Hello World!\n");
- return NULL;
-}
-
-int
-main(int argc, const char *argv[])
-{
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t *engine = wasm_engine_new();
- wasm_store_t *store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
- FILE *file = fopen("serialize.wasm", "rb");
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
- fseek(file, 0L, SEEK_END);
- size_t file_size = ftell(file);
- fseek(file, 0L, SEEK_SET);
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t *module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Serialize module.
- printf("Serializing module...\n");
- own wasm_byte_vec_t serialized;
- wasm_module_serialize(module, &serialized);
-
- wasm_module_delete(module);
-
- // Deserialize module.
- printf("Deserializing module...\n");
- own wasm_module_t *deserialized =
- wasm_module_deserialize(store, &serialized);
- if (!deserialized) {
- printf("> Error deserializing module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&serialized);
-
- // Create external print functions.
- printf("Creating callback...\n");
- own wasm_functype_t *hello_type = wasm_functype_new_0_0();
- own wasm_func_t *hello_func =
- wasm_func_new(store, hello_type, hello_callback);
-
- wasm_functype_delete(hello_type);
-
- // Instantiate.
- printf("Instantiating deserialized module...\n");
- wasm_extern_t *externs[] = { wasm_func_as_extern(hello_func) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t *instance =
- wasm_instance_new(store, deserialized, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_func_delete(hello_func);
-
- // Extract export.
- printf("Extracting export...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- return 1;
- }
- const wasm_func_t *run_func = wasm_extern_as_func(exports.data[0]);
- if (run_func == NULL) {
- printf("> Error accessing export!\n");
- return 1;
- }
-
- wasm_module_delete(deserialized);
- wasm_instance_delete(instance);
-
- // Call.
- printf("Calling export...\n");
- wasm_val_vec_t empty = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(run_func, &empty, &empty);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- return 1;
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.wat
deleted file mode 100644
index 1c56c5582..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/serialize.wat
+++ /dev/null
@@ -1,4 +0,0 @@
-(module
- (func $hello (import "" "hello"))
- (func (export "run") (call $hello))
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.c
deleted file mode 100644
index c4a7da8bc..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.c
+++ /dev/null
@@ -1,218 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-// A function to be called from Wasm code.
-own wasm_trap_t* neg_callback(
- const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- printf("Calling back...\n");
- results->data[0].kind = WASM_I32;
- results->data[0].of.i32 = -args->data[0].of.i32;
- return NULL;
-}
-
-
-wasm_table_t* get_export_table(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_table(exports->data[i])) {
- printf("> Error accessing table export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_table(exports->data[i]);
-}
-
-wasm_func_t* get_export_func(const wasm_extern_vec_t* exports, size_t i) {
- if (exports->size <= i || !wasm_extern_as_func(exports->data[i])) {
- printf("> Error accessing function export %zu!\n", i);
- exit(1);
- }
- return wasm_extern_as_func(exports->data[i]);
-}
-
-
-void check(bool success) {
- if (!success) {
- printf("> Error, expected success\n");
- exit(1);
- }
-}
-
-void check_table(wasm_table_t* table, int32_t i, bool expect_set) {
- own wasm_ref_t* ref = wasm_table_get(table, i);
- check((ref != NULL) == expect_set);
- if (ref) wasm_ref_delete(ref);
-}
-
-void check_call(wasm_func_t* func, int32_t arg1, int32_t arg2, int32_t expected) {
- wasm_val_t vs[2] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };
- wasm_val_t r[1] = { WASM_INIT_VAL };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
- wasm_val_vec_t results = WASM_ARRAY_VEC(r);
- wasm_trap_t *trap = wasm_func_call(func, &args, &results);
- if (trap) {
- printf("> Error on calling\n");
- wasm_trap_delete(trap);
- exit(1);
- }
-
- if (r[0].of.i32 != expected) {
- printf("> Error on result\n");
- exit(1);
- }
-}
-
-void check_trap(wasm_func_t* func, int32_t arg1, int32_t arg2) {
- wasm_val_t vs[2] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };
- wasm_val_t r[1] = { WASM_INIT_VAL };
- wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
- wasm_val_vec_t results = WASM_ARRAY_VEC(r);
- own wasm_trap_t* trap = wasm_func_call(func, &args, &results);
- if (! trap) {
- printf("> Error on result, expected trap\n");
- exit(1);
- }
- wasm_trap_delete(trap);
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("table.aot", "rb");
-#else
- FILE* file = fopen("table.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_vec_t imports = WASM_EMPTY_VEC;
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- // Extract export.
- printf("Extracting exports...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- size_t i = 0;
- wasm_table_t* table = get_export_table(&exports, i++);
- wasm_func_t* call_indirect = get_export_func(&exports, i++);
- wasm_func_t* f = get_export_func(&exports, i++);
- wasm_func_t* g = get_export_func(&exports, i++);
-
- wasm_module_delete(module);
-
- // Create external function.
- printf("Creating callback...\n");
- own wasm_functype_t* neg_type = wasm_functype_new_1_1(wasm_valtype_new_i32(), wasm_valtype_new_i32());
- own wasm_func_t* h = wasm_func_new(store, neg_type, neg_callback);
-
- wasm_functype_delete(neg_type);
-
- // Try cloning.
- own wasm_table_t* copy = wasm_table_copy(table);
- assert(wasm_table_same(table, copy));
- wasm_table_delete(copy);
-
- // Check initial table.
- printf("Checking table...\n");
- check(wasm_table_size(table) == 2);
- check_table(table, 0, false);
- check_table(table, 1, true);
- check_trap(call_indirect, 0, 0);
- check_call(call_indirect, 7, 1, 7);
- check_trap(call_indirect, 0, 2);
-
- // Mutate table.
- printf("Mutating table...\n");
- check(wasm_table_set(table, 0, wasm_func_as_ref(g)));
- check(wasm_table_set(table, 1, NULL));
- wasm_ref_t *ref_f = wasm_func_as_ref(f);
- check(! wasm_table_set(table, 2, ref_f));
- wasm_ref_delete(ref_f);
- check_table(table, 0, true);
- check_table(table, 1, false);
- check_call(call_indirect, 7, 0, 666);
- check_trap(call_indirect, 0, 1);
- check_trap(call_indirect, 0, 2);
-
- // Grow table.
- // DO NOT SUPPORT
- printf("Bypass Growing table...\n");
-
- wasm_func_delete(h);
- wasm_extern_vec_delete(&exports);
- wasm_instance_delete(instance);
-
- // Create stand-alone table.
- // DO NOT SUPPORT
- // TODO(wasm+): Once Wasm allows multiple tables, turn this into import.
- printf("Bypass Creating stand-alone table...\n");
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.wat
deleted file mode 100644
index d3e3a945a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/table.wat
+++ /dev/null
@@ -1,12 +0,0 @@
-(module
- (table (export "table") 2 10 funcref)
-
- (func (export "call_indirect") (param i32 i32) (result i32)
- (call_indirect (param i32) (result i32) (local.get 0) (local.get 1))
- )
-
- (func $f (export "f") (param i32) (result i32) (local.get 0))
- (func (export "g") (param i32) (result i32) (i32.const 666))
-
- (elem (i32.const 1) $f)
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.c
deleted file mode 100644
index cbe4aaf44..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.c
+++ /dev/null
@@ -1,187 +0,0 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-const int N_THREADS = 10;
-const int N_REPS = 3;
-
-// A function to be called from Wasm code.
-own wasm_trap_t *
-callback(const wasm_val_vec_t *args, wasm_val_vec_t *results)
-{
- assert(args->data[0].kind == WASM_I32);
- printf("> Thread %d running\n", args->data[0].of.i32);
- return NULL;
-}
-
-typedef struct {
- wasm_engine_t *engine;
- wasm_shared_module_t *module;
- int id;
-} thread_args;
-
-void *
-run(void *args_abs)
-{
- thread_args *args = (thread_args *)args_abs;
-
- // Rereate store and module.
- own wasm_store_t *store = wasm_store_new(args->engine);
- own wasm_module_t *module = wasm_module_obtain(store, args->module);
-
- // Run the example N times.
- for (int i = 0; i < N_REPS; ++i) {
- usleep(100000);
-
- // Create imports.
- own wasm_functype_t *func_type =
- wasm_functype_new_1_0(wasm_valtype_new_i32());
- own wasm_func_t *func = wasm_func_new(store, func_type, callback);
- wasm_functype_delete(func_type);
-
- wasm_val_t val = WASM_I32_VAL((int32_t)args->id);
- own wasm_globaltype_t *global_type =
- wasm_globaltype_new(wasm_valtype_new_i32(), WASM_CONST);
- own wasm_global_t *global = wasm_global_new(store, global_type, &val);
- wasm_globaltype_delete(global_type);
-
- // Instantiate.
- wasm_extern_t *externs[] = {
- wasm_func_as_extern(func),
- wasm_global_as_extern(global),
- };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t *instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return NULL;
- }
-
- wasm_func_delete(func);
- wasm_global_delete(global);
-
- // Extract export.
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size == 0) {
- printf("> Error accessing exports!\n");
- return NULL;
- }
- const wasm_func_t *run_func = wasm_extern_as_func(exports.data[0]);
- if (run_func == NULL) {
- printf("> Error accessing export!\n");
- return NULL;
- }
-
- wasm_instance_delete(instance);
-
- // Call.
- wasm_val_vec_t empty = WASM_EMPTY_VEC;
- wasm_trap_t *trap = wasm_func_call(run_func, &empty, &empty);
- if (trap) {
- printf("> Error calling function!\n");
- wasm_trap_delete(trap);
- return NULL;
- }
-
- wasm_extern_vec_delete(&exports);
- }
-
- wasm_module_delete(module);
- wasm_store_delete(store);
-
- free(args_abs);
-
- return NULL;
-}
-
-int
-main(int argc, const char *argv[])
-{
- // Initialize.
- wasm_engine_t *engine = wasm_engine_new();
-
- // Load binary.
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE *file = fopen("threads.aot", "rb");
-#else
- FILE *file = fopen("threads.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- return 1;
- }
- fclose(file);
-
- // Compile and share.
- own wasm_store_t *store = wasm_store_new(engine);
- own wasm_module_t *module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- own wasm_shared_module_t *shared = wasm_module_share(module);
-
- wasm_module_delete(module);
- wasm_store_delete(store);
-
- // Spawn threads.
- pthread_t threads[N_THREADS];
- for (int i = 0; i < N_THREADS; i++) {
- thread_args *args = malloc(sizeof(thread_args));
- args->id = i;
- args->engine = engine;
- args->module = shared;
- printf("Initializing thread %d...\n", i);
- pthread_create(&threads[i], NULL, &run, args);
- }
-
- for (int i = 0; i < N_THREADS; i++) {
- printf("Waiting for thread: %d\n", i);
- pthread_join(threads[i], NULL);
- }
-
- wasm_shared_module_delete(shared);
- wasm_engine_delete(engine);
-
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.wat
deleted file mode 100644
index 29a3bbcc1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/threads.wat
+++ /dev/null
@@ -1,5 +0,0 @@
-(module
- (func $message (import "" "hello") (param i32))
- (global $id (import "" "id") i32)
- (func (export "run") (call $message (global.get $id)))
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.c
deleted file mode 100644
index 2637b7346..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.c
+++ /dev/null
@@ -1,184 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "wasm_c_api.h"
-
-#define own
-
-// A function to be called from Wasm code.
-own wasm_trap_t* fail_callback(
- void* env, const wasm_val_vec_t* args, wasm_val_vec_t* results
-) {
- printf("Calling back...\n");
- own wasm_name_t message;
- wasm_name_new_from_string_nt(&message, "callback abort");
- own wasm_trap_t* trap = wasm_trap_new((wasm_store_t*)env, &message);
- wasm_name_delete(&message);
- return trap;
-}
-
-
-void print_frame(wasm_frame_t* frame) {
- printf("> %p @ 0x%zx = %"PRIu32".0x%zx\n",
- wasm_frame_instance(frame),
- wasm_frame_module_offset(frame),
- wasm_frame_func_index(frame),
- wasm_frame_func_offset(frame)
- );
-}
-
-
-int main(int argc, const char* argv[]) {
- // Initialize.
- printf("Initializing...\n");
- wasm_engine_t* engine = wasm_engine_new();
- wasm_store_t* store = wasm_store_new(engine);
-
- // Load binary.
- printf("Loading binary...\n");
-#if WASM_ENABLE_AOT != 0 && WASM_ENABLE_INTERP == 0
- FILE* file = fopen("trap.aot", "rb");
-#else
- FILE* file = fopen("trap.wasm", "rb");
-#endif
- if (!file) {
- printf("> Error loading module!\n");
- return 1;
- }
-
- int ret = fseek(file, 0L, SEEK_END);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- long file_size = ftell(file);
- if (file_size == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- ret = fseek(file, 0L, SEEK_SET);
- if (ret == -1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
-
- wasm_byte_vec_t binary;
- wasm_byte_vec_new_uninitialized(&binary, file_size);
- if (fread(binary.data, file_size, 1, file) != 1) {
- printf("> Error loading module!\n");
- fclose(file);
- return 1;
- }
- fclose(file);
-
- // Compile.
- printf("Compiling module...\n");
- own wasm_module_t* module = wasm_module_new(store, &binary);
- if (!module) {
- printf("> Error compiling module!\n");
- return 1;
- }
-
- wasm_byte_vec_delete(&binary);
-
- // Create external print functions.
- printf("Creating callback...\n");
- own wasm_functype_t* fail_type =
- wasm_functype_new_0_1(wasm_valtype_new_i32());
- own wasm_func_t* fail_func =
- wasm_func_new_with_env(store, fail_type, fail_callback, store, NULL);
-
- wasm_functype_delete(fail_type);
-
- // Instantiate.
- printf("Instantiating module...\n");
- wasm_extern_t* externs[] = { wasm_func_as_extern(fail_func) };
- wasm_extern_vec_t imports = WASM_ARRAY_VEC(externs);
- own wasm_instance_t* instance =
- wasm_instance_new(store, module, &imports, NULL);
- if (!instance) {
- printf("> Error instantiating module!\n");
- return 1;
- }
-
- wasm_func_delete(fail_func);
-
- // Extract export.
- printf("Extracting exports...\n");
- own wasm_extern_vec_t exports;
- wasm_instance_exports(instance, &exports);
- if (exports.size < 2) {
- printf("> Error accessing exports!\n");
- return 1;
- }
-
- wasm_module_delete(module);
- wasm_instance_delete(instance);
-
- // Call.
- for (int i = 0; i < 2; ++i) {
- const wasm_func_t* func = wasm_extern_as_func(exports.data[i]);
- if (func == NULL) {
- printf("> Error accessing export!\n");
- return 1;
- }
-
- printf("Calling export %d...\n", i);
- wasm_val_vec_t args = WASM_EMPTY_VEC;
- wasm_val_vec_t results = WASM_EMPTY_VEC;
- own wasm_trap_t* trap = wasm_func_call(func, &args, &results);
- if (!trap) {
- printf("> Error calling function, expected trap!\n");
- return 1;
- }
-
- printf("Printing message...\n");
- own wasm_name_t message;
- wasm_trap_message(trap, &message);
- printf("> %s\n", message.data);
- assert(message.num_elems > 0);
- assert(strncmp(message.data, "Exception: ", strlen("Exception: ")) == 0);
-
- printf("Printing origin...\n");
- own wasm_frame_t* frame = wasm_trap_origin(trap);
- if (frame) {
- print_frame(frame);
- wasm_frame_delete(frame);
- } else {
- printf("> Empty origin.\n");
- }
-
- printf("Printing trace...\n");
- own wasm_frame_vec_t trace;
- wasm_trap_trace(trap, &trace);
- if (trace.size > 0) {
- for (size_t i = 0; i < trace.size; ++i) {
- print_frame(trace.data[i]);
- }
- } else {
- printf("> Empty trace.\n");
- }
-
- wasm_frame_vec_delete(&trace);
- wasm_trap_delete(trap);
- wasm_name_delete(&message);
- }
-
- wasm_extern_vec_delete(&exports);
-
- // Shut down.
- printf("Shutting down...\n");
- wasm_store_delete(store);
- wasm_engine_delete(engine);
-
- // All done.
- printf("Done.\n");
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.wat b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.wat
deleted file mode 100644
index dfd20fb12..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/trap.wat
+++ /dev/null
@@ -1,5 +0,0 @@
-(module
- (func $callback (import "" "callback") (result i32))
- (func (export "callback") (result i32) (call $callback))
- (func (export "unreachable") (result i32) (unreachable) (i32.const 1))
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/utils/multi_module_utils.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/utils/multi_module_utils.c
deleted file mode 100644
index 67010914b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/wasm-c-api/src/utils/multi_module_utils.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "bh_read_file.h"
-#include "wasm_export.h"
-
-static char *
-build_module_path(const char *module_name)
-{
- const char *module_search_path = ".";
- const char *format = "%s/%s.wasm";
- int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
- + strlen(".wasm") + 1;
- char *wasm_file_name = BH_MALLOC(sz);
- if (!wasm_file_name) {
- return NULL;
- }
-
- snprintf(wasm_file_name, sz, format, module_search_path, module_name);
- return wasm_file_name;
-}
-
-bool
-reader(const char *module_name, uint8 **p_buffer, uint32 *p_size)
-{
- char *wasm_file_path = build_module_path(module_name);
- if (!wasm_file_path) {
- return false;
- }
-
- *p_buffer = (uint8_t *)bh_read_file_to_buffer(wasm_file_path, p_size);
- BH_FREE(wasm_file_path);
- return *p_buffer != NULL;
-}
-
-void
-destroyer(uint8 *buffer, uint32 size)
-{
- if (!buffer) {
- return;
- }
-
- BH_FREE(buffer);
- buffer = NULL;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/CMakeLists.txt
deleted file mode 100644
index 667f0b4e8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/CMakeLists.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-project(wasm_workloads)
-
-#######################################
-add_subdirectory(bwa)
-add_subdirectory(meshoptimizer)
-add_subdirectory(wasm-av1)
-
-#######################################
-include(ExternalProject)
-
-################ iwasm ################
-ExternalProject_Add(iwasm
- PREFIX
- iwasm-build
- BUILD_ALWAYS
- YES
- SOURCE_DIR
- ${CMAKE_CURRENT_SOURCE_DIR}/../../product-mini/platforms/linux
- CONFIGURE_COMMAND
- ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/../../product-mini/platforms/linux -B build -DWAMR_BUILD_LIBC_EMCC=1
- BUILD_COMMAND
- ${CMAKE_COMMAND} --build build --parallel 4
- INSTALL_COMMAND
- # FIXME: replace with --install
- ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_CURRENT_BINARY_DIR}/iwasm-build/src/iwasm-build/build/iwasm
- ${CMAKE_CURRENT_BINARY_DIR}/iwasm
-)
-
-################ wamrc ################
-ExternalProject_Add(wamrc
- PREFIX
- wamrc-build
- BUILD_ALWAYS
- YES
- SOURCE_DIR
- ${CMAKE_CURRENT_SOURCE_DIR}/../../wamr-compiler
- CONFIGURE_COMMAND
- ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/../../wamr-compiler -B build
- BUILD_COMMAND
- ${CMAKE_COMMAND} --build build --parallel 4
- INSTALL_COMMAND
- # FIXME: replace with --install
- ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_CURRENT_BINARY_DIR}/wamrc-build/src/wamrc-build/build/wamrc
- ${CMAKE_CURRENT_BINARY_DIR}/wamrc
-)
-
-################ .aot ################
-add_custom_target(
- bwa_to_aot
- ALL
- DEPENDS
- bwa wamrc
- COMMAND
- ./wamrc -o bwa.aot ./bwa/bwa.wasm
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-add_custom_target(
- codecbench_to_aot
- ALL
- DEPENDS
- codecbench wamrc
- COMMAND
- ./wamrc -o codecbench.aot ./meshoptimizer/codecbench.wasm
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-add_custom_target(
- av1_to_aot
- ALL
- DEPENDS
- av1 wamrc
- COMMAND
- ./wamrc -o testavx.aot ./wasm-av1/testavx.opt.wasm
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-################ smoking test ################
-include(CTest)
-
-add_test(
- NAME
- run_bwa
- COMMAND
- ./iwasm --dir=. ./bwa.aot index ./bwa/hs38DH-extra.fa
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-add_test(
- NAME
- run_codecbench
- COMMAND
- ./iwasm codecbench.aot
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-add_test(
- NAME
- run_av1
- COMMAND
- ./iwasm --dir=. testavx.aot ./wasm-av1/elephants_dream_480p24.ivf
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/README.md
deleted file mode 100644
index 0e6a3a41b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-All workloads have similar requirment of software dependencies, including **emsdk** and **binaryen**
-
-> There might be slight differences when using MacOS and other Linux distro than Ubuntu. This document targets
-Ubuntu 20.04 as an example.
-
-## Installation instructions
-
-use [preparation.sh](./preparation.sh) to install all dependencies before compiling any workload. Or use [*vscode DevContainer*](../../.devcontainer/)
-
-The script installs below software:
-
-- **emsdk**. Refer to [the guide](https://emscripten.org/docs/getting_started/downloads.html). Don't forget to activate
- emsdk and set up environment variables. Verify it with `echo ${EMSDK}`. Please be sure to install and activate the building
- of 3.0.0
-
-``` bash
-$ cd /opt
-$ git clone https://github.com/emscripten-core/emsdk.git
-$ cd emsdk
-$ git pull
-$ ./emsdk install 3.0.0
-$ ./emsdk activate 3.0.0
-$ echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc
-```
-
-- **binaryen**. Install
- [latest release](https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz)
- to */opt/binaryen*
-
-``` bash
-$ wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/${BINARYEN_FILE}
-$ tar zxf ${BINARYEN_FILE} -C /opt
-$ ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/.gitignore
deleted file mode 100644
index 09f3fe927..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-xnnpack
-build
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/CMakeLists.txt
deleted file mode 100644
index aef138d5e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/CMakeLists.txt
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.0)
-
-project(xnnpack_wasm)
-
-################ EMCC ################
-include(ExternalProject)
-
-ExternalProject_Add(xnnpack
- PREFIX xnnpack
- GIT_REPOSITORY https://github.com/google/XNNPACK.git
- GIT_TAG 4570a7151aa4f3e57eca14a575eeff6bb13e26be
- GIT_PROGRESS ON
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack
- UPDATE_COMMAND git restore .
- && cmake -E copy ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack/google3/third_party/XNNPACK/microkernels.bzl
- ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack/
- && git apply ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack.patch
- CONFIGURE_COMMAND ""
- # grep xnnpack_benchmark -A 1 BUILD.bazel \
- # | grep "name =" \
- # | awk '{print $3}' \
- # | sed -e 's/\"//g' -e 's/,//g' -e 's/^/\/\/:/g'
- BUILD_COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack
- && bazel --output_user_root=build-user-output build -c opt --config=wasm
- //:qs8_dwconv_bench.wasm
- //:qs8_f32_vcvt_bench.wasm
- //:qs8_gemm_bench.wasm
- //:qs8_requantization_bench.wasm
- //:qs8_vadd_bench.wasm
- //:qs8_vaddc_bench.wasm
- //:qs8_vcvt_bench.wasm
- //:qs8_vlrelu_bench.wasm
- //:qs8_vmul_bench.wasm
- //:qs8_vmulc_bench.wasm
- //:qu8_f32_vcvt_bench.wasm
- //:qu8_gemm_bench.wasm
- //:qu8_requantization_bench.wasm
- //:qu8_vadd_bench.wasm
- //:qu8_vaddc_bench.wasm
- //:qu8_vcvt_bench.wasm
- //:qu8_vlrelu_bench.wasm
- //:qu8_vmul_bench.wasm
- //:qu8_vmulc_bench.wasm
- //:bf16_gemm_bench.wasm
- //:f16_igemm_bench.wasm
- //:f16_gemm_bench.wasm
- //:f16_raddstoreexpminusmax_bench.wasm
- //:f16_spmm_bench.wasm
- //:f16_vsigmoid_bench.wasm
- //:f16_f32_vcvt_bench.wasm
- //:f32_igemm_bench.wasm
- //:f32_conv_hwc_bench.wasm
- //:f16_conv_hwc2chw_bench.wasm
- //:f16_gavgpool_cw_bench.wasm
- //:f32_gavgpool_cw_bench.wasm
- //:f32_conv_hwc2chw_bench.wasm
- //:f16_dwconv_bench.wasm
- //:f32_dwconv_bench.wasm
- //:f32_dwconv2d_chw_bench.wasm
- //:f16_dwconv2d_chw_bench.wasm
- //:f32_f16_vcvt_bench.wasm
- //:xx_transpose_bench.wasm
- //:x8_transpose_bench.wasm
- //:x16_transpose_bench.wasm
- //:x24_transpose_bench.wasm
- //:x32_transpose_bench.wasm
- //:x64_transpose_bench.wasm
- //:f32_gemm_bench.wasm
- //:f32_qs8_vcvt_bench.wasm
- //:f32_qu8_vcvt_bench.wasm
- //:f32_raddexpminusmax_bench.wasm
- //:f32_raddextexp_bench.wasm
- //:f32_raddstoreexpminusmax_bench.wasm
- //:f32_rmax_bench.wasm
- //:f32_spmm_bench.wasm
- //:f32_softmax_bench.wasm
- //:f16_velu_bench.wasm
- //:f32_velu_bench.wasm
- //:f32_vhswish_bench.wasm
- //:f32_vlrelu_bench.wasm
- //:f32_vrelu_bench.wasm
- //:f32_vscaleexpminusmax_bench.wasm
- //:f32_vscaleextexp_bench.wasm
- //:f32_vsigmoid_bench.wasm
- //:f16_vsqrt_bench.wasm
- //:f32_vsqrt_bench.wasm
- //:f32_im2col_gemm_bench.wasm
- //:rounding_bench.wasm
- //:s16_rmaxabs_bench.wasm
- //:s16_window_bench.wasm
- //:u32_filterbank_accumulate_bench.wasm
- //:u32_filterbank_subtract_bench.wasm
- //:u32_vlog_bench.wasm
- //:u64_u32_vsqrtshift_bench.wasm
- //:i16_vlshift_bench.wasm
- //:cs16_vsquareabs_bench.wasm
- //:cs16_bfly4_bench.wasm
- //:cs16_fftr_bench.wasm
- //:x8_lut_bench.wasm
- //:abs_bench.wasm
- //:average_pooling_bench.wasm
- //:bankers_rounding_bench.wasm
- //:ceiling_bench.wasm
- //:channel_shuffle_bench.wasm
- //:convert_bench.wasm
- //:convolution_bench.wasm
- //:deconvolution_bench.wasm
- //:elu_bench.wasm
- //:floor_bench.wasm
- //:global_average_pooling_bench.wasm
- //:hardswish_bench.wasm
- //:leaky_relu_bench.wasm
- //:max_pooling_bench.wasm
- //:negate_bench.wasm
- //:sigmoid_bench.wasm
- //:prelu_bench.wasm
- //:softmax_bench.wasm
- //:square_bench.wasm
- //:square_root_bench.wasm
- //:truncation_bench.wasm
- //:f16_gemm_e2e_bench.wasm
- //:f32_dwconv_e2e_bench.wasm
- //:f32_gemm_e2e_bench.wasm
- //:qs8_dwconv_e2e_bench.wasm
- //:qs8_gemm_e2e_bench.wasm
- //:qu8_gemm_e2e_bench.wasm
- //:qu8_dwconv_e2e_bench.wasm
- //:end2end_bench.wasm
- //:f16_exp_ulp_eval.wasm
- //:f16_expminus_ulp_eval.wasm
- //:f16_expm1minus_ulp_eval.wasm
- //:f16_sigmoid_ulp_eval.wasm
- //:f16_sqrt_ulp_eval.wasm
- //:f32_exp_ulp_eval.wasm
- //:f32_expminus_ulp_eval.wasm
- //:f32_expm1minus_ulp_eval.wasm
- //:f32_extexp_ulp_eval.wasm
- //:f32_sigmoid_ulp_eval.wasm
- //:f32_sqrt_ulp_eval.wasm
- //:f32_tanh_ulp_eval.wasm
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
- ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack/bazel-out/wasm-opt/bin/
- ${CMAKE_BINARY_DIR}/wasm-opt
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/README.md
deleted file mode 100644
index 7984d9cee..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-"XNNPACK" sample introduction
-==============
-
-This sample demonstrates how to build [XNNPACK](https://github.com/google/XNNPACK) benchmarks into WebAssembly with emsdk toolchain and run them with iwasm.
-
-## Installation toolchains
-
-please refer to [installation instructions](../README.md).
-
-## Build XNNPACK
-
-```bash
-cd <wamr-dir>/samples/workload/XNNPACK
-mkdir build
-cd build
-cmake ..
-```
-The wasm files are generated under folder samples/workload/XNNPACK/xnnpack/bazel-bin.
-
-## Run benchmarks
-
-Firstly please build iwasm with simd, libc-emcc and lib-pthread support:
-
-``` bash
-$ cd <wamr-dir>/product-mini/platforms/linux/
-$ mkdir build && cd build
-$ cmake .. -DWAMR_BUILD_LIBC_EMCC=1 -DWAMR_BUILD_LIB_PTHREAD=1
-$ make
-```
-
-And please build wamrc:
-
-``` bash
-cd <wamr-dir>/wamr-compiler
-./build_llvm.sh
-mkdir build && cd build
-cmake ..
-make
-```
-
-Then compile wasm file to aot file and run:
-
-``` shell
-$ cd <wamr-dir>/samples/workload/XNNPACK/xnnpack/bazel-bin
-$ wamrc -o average_pooling_bench.aot average_pooling_bench.wasm (or other wasm files)
-$ iwasm average_pooling_bench.aot
-```
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/benchmark.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/benchmark.patch
deleted file mode 100644
index 713b476d2..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/benchmark.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git include/benchmark/benchmark.h include/benchmark/benchmark.h
-index 9b54802..baa5938 100755
---- include/benchmark/benchmark.h
-+++ include/benchmark/benchmark.h
-@@ -364,7 +364,9 @@ template <class Tp>
- inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
- internal::UseCharPointer(&reinterpret_cast<char const volatile&>(value));
- }
-+
- // FIXME Add ClobberMemory() for non-gnu and non-msvc compilers
-+inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() { }
- #endif
-
- // This class is used for user-defined counters.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/xnnpack.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/xnnpack.patch
deleted file mode 100644
index 3fb6b230b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/XNNPACK/xnnpack.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-diff --git a/.bazelrc b/.bazelrc
-index 688279da1..376996885 100644
---- a/.bazelrc
-+++ b/.bazelrc
-@@ -53,4 +53,9 @@ build:ios_fat --watchos_cpus=armv7k
- build:macos --apple_platform_type=macos
-
- build:macos_arm64 --config=macos
--build:macos_arm64 --cpu=darwin_arm64
-\ No newline at end of file
-+build:macos_arm64 --cpu=darwin_arm64
-+
-+build:wasm --cpu=wasm
-+build:wasm --features=wasm_simd
-+build:wasm --crosstool_top=@emsdk//emscripten_toolchain:everything
-+build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
-diff --git a/WORKSPACE b/WORKSPACE
-index cd8960ffa..787e03ca8 100644
---- a/WORKSPACE
-+++ b/WORKSPACE
-@@ -29,8 +29,9 @@ http_archive(
- # Google Benchmark library, used in micro-benchmarks.
- http_archive(
- name = "com_google_benchmark",
-- strip_prefix = "benchmark-main",
-- urls = ["https://github.com/google/benchmark/archive/main.zip"],
-+ sha256 = "1ba14374fddcd9623f126b1a60945e4deac4cdc4fb25a5f25e7f779e36f2db52",
-+ strip_prefix = "benchmark-d2a8a4ee41b923876c034afb939c4fc03598e622",
-+ urls = ["https://github.com/google/benchmark/archive/d2a8a4ee41b923876c034afb939c4fc03598e622.zip"],
- )
-
- # FP16 library, used for half-precision conversions
-@@ -92,8 +93,25 @@ http_archive(
- ],
- )
-
-+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-+http_archive(
-+ name = "emsdk",
-+ # Use emsdk-3.0.0 since the larger version may:
-+ # - compress the wasm file into a tar file but not directly generate wasm file
-+ # - generate incomplete implementation of libc API, e.g. throw exception in getentropy
-+ strip_prefix = "emsdk-3.0.0/bazel",
-+ url = "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.0.0.tar.gz",
-+ sha256 = "a41dccfd15be9e85f923efaa0ac21943cbab77ec8d39e52f25eca1ec61a9ac9e"
-+)
-+
-+load("@emsdk//:deps.bzl", emsdk_deps = "deps")
-+emsdk_deps()
-+
-+load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
-+emsdk_emscripten_deps()
-+
- # Android NDK location and version is auto-detected from $ANDROID_NDK_HOME environment variable
--android_ndk_repository(name = "androidndk")
-+#android_ndk_repository(name = "androidndk")
-
- # Android SDK location and API is auto-detected from $ANDROID_HOME environment variable
--android_sdk_repository(name = "androidsdk")
-+#android_sdk_repository(name = "androidsdk")
-diff --git a/build_defs.bzl b/build_defs.bzl
-index b8217a18d..6f2d1675e 100644
---- a/build_defs.bzl
-+++ b/build_defs.bzl
-@@ -380,7 +380,7 @@ def xnnpack_benchmark(name, srcs, copts = [], deps = [], tags = []):
- explicitly specified.
- """
- native.cc_binary(
-- name = name,
-+ name = name + ".wasm",
- srcs = srcs,
- copts = xnnpack_std_cxxopts() + [
- "-Iinclude",
-@@ -405,5 +405,5 @@ def xnnpack_benchmark(name, srcs, copts = [], deps = [], tags = []):
- ":emscripten": xnnpack_emscripten_deps(),
- "//conditions:default": [],
- }),
-- tags = tags,
-+ tags = tags,
- )
-diff --git a/emscripten.bzl b/emscripten.bzl
-index f1557a7b1..7f964a094 100644
---- a/emscripten.bzl
-+++ b/emscripten.bzl
-@@ -25,12 +25,19 @@ def xnnpack_emscripten_benchmark_linkopts():
- """Emscripten-specific linkopts for benchmarks."""
- return [
- "-s ASSERTIONS=1",
-- "-s ENVIRONMENT=node,shell,web",
-- "-s ERROR_ON_UNDEFINED_SYMBOLS=1",
-- "-s EXIT_RUNTIME=1",
-+ "-s ERROR_ON_UNDEFINED_SYMBOLS=0",
- "-s ALLOW_MEMORY_GROWTH=1",
- "-s TOTAL_MEMORY=536870912", # 512M
-- "--pre-js $(location :preamble.js.lds)",
-+ "-s USE_PTHREADS=0",
-+ "-s STANDALONE_WASM=1",
-+ "-Wno-unused",
-+ "-Wno-unused-variable",
-+ "-Wno-unused-command-line-argument",
-+ "-Wl,--export=__heap_base",
-+ "-Wl,--export=__data_end",
-+ "-Wl,--export=malloc",
-+ "-Wl,--export=free",
-+ "--oformat=wasm",
- ]
-
- def xnnpack_emscripten_deps():
-diff --git a/src/log.c b/src/log.c
-index 5715f2f85..4b3e4261b 100644
---- a/src/log.c
-+++ b/src/log.c
-@@ -55,7 +55,7 @@
- #endif
-
- #if XNN_LOG_TO_STDIO
--static void xnn_vlog(int output_handle, const char* prefix, size_t prefix_length, const char* format, va_list args) {
-+void xnn_vlog(int output_handle, const char* prefix, size_t prefix_length, const char* format, va_list args) {
- char stack_buffer[XNN_LOG_STACK_BUFFER_SIZE];
- char* heap_buffer = NULL;
- char* out_buffer = &stack_buffer[0];
-diff --git a/third_party/cpuinfo.BUILD b/third_party/cpuinfo.BUILD
-index 1997f4e3a..5e03c43af 100644
---- a/third_party/cpuinfo.BUILD
-+++ b/third_party/cpuinfo.BUILD
-@@ -150,7 +150,7 @@ cc_library(
- "src/arm/midr.h",
- ],
- deps = [
-- "@clog",
-+ "//deps/clog"
- ],
- )
-
-@@ -352,5 +352,5 @@ config_setting(
-
- config_setting(
- name = "emscripten",
-- values = {"crosstool_top": "//toolchain:emscripten"},
-+ values = {"crosstool_top": "@emsdk//emscripten_toolchain:everything"},
- )
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/.gitignore
deleted file mode 100644
index cd7209590..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-build
-libz
-bwa
-include
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.bwa_wasm.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.bwa_wasm.txt
deleted file mode 100644
index a8d1d8821..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.bwa_wasm.txt
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-project(bwa_wasm C)
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake)
-
-################ dependencies ################
-find_package(Binaryen 111 REQUIRED)
-
-################ LIBZ ################
-set(LIBZ_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libz)
-add_library(z_wasm STATIC
- ${LIBZ_SRC_DIR}/adler32.c
- ${LIBZ_SRC_DIR}/compress.c
- ${LIBZ_SRC_DIR}/crc32.c
- ${LIBZ_SRC_DIR}/deflate.c
- ${LIBZ_SRC_DIR}/gzclose.c
- ${LIBZ_SRC_DIR}/gzlib.c
- ${LIBZ_SRC_DIR}/gzread.c
- ${LIBZ_SRC_DIR}/gzwrite.c
- ${LIBZ_SRC_DIR}/infback.c
- ${LIBZ_SRC_DIR}/inffast.c
- ${LIBZ_SRC_DIR}/inflate.c
- ${LIBZ_SRC_DIR}/inftrees.c
- ${LIBZ_SRC_DIR}/trees.c
- ${LIBZ_SRC_DIR}/uncompr.c
- ${LIBZ_SRC_DIR}/zutil.c
-)
-
-set_target_properties(z_wasm PROPERTIES LINKER_LANGUAGE C)
-
-target_compile_definitions(z_wasm PRIVATE Z_HAVE_UNISTD_H _LARGEFILE64_SOURCE=1)
-
-target_compile_options(z_wasm
- PRIVATE
- -Wno-unused-function
- -Wno-unused-variable
-)
-
-target_include_directories(z_wasm
- PUBLIC
- ${LIBZ_SRC_DIR}
-)
-
-################ BWA_WASM ################
-set(BWA_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(BWA_SOURCE
- ${BWA_SRC_DIR}/utils.c
- ${BWA_SRC_DIR}/kthread.c
- ${BWA_SRC_DIR}/kstring.c
- ${BWA_SRC_DIR}/ksw.c
- ${BWA_SRC_DIR}/bwt.c
- ${BWA_SRC_DIR}/bntseq.c
- ${BWA_SRC_DIR}/bwa.c
- ${BWA_SRC_DIR}/bwamem.c
- ${BWA_SRC_DIR}/bwamem_pair.c
- ${BWA_SRC_DIR}/bwamem_extra.c
- ${BWA_SRC_DIR}/malloc_wrap.c
- ${BWA_SRC_DIR}/QSufSort.c
- ${BWA_SRC_DIR}/bwt_gen.c
- ${BWA_SRC_DIR}/rope.c
- ${BWA_SRC_DIR}/rle.c
- ${BWA_SRC_DIR}/is.c
- ${BWA_SRC_DIR}/bwtindex.c
- ${BWA_SRC_DIR}/bwashm.c
- ${BWA_SRC_DIR}/bwase.c
- ${BWA_SRC_DIR}/bwaseqio.c
- ${BWA_SRC_DIR}/bwtgap.c
- ${BWA_SRC_DIR}/bwtaln.c
- ${BWA_SRC_DIR}/bamlite.c
- ${BWA_SRC_DIR}/bwape.c
- ${BWA_SRC_DIR}/kopen.c
- ${BWA_SRC_DIR}/pemerge.c
- ${BWA_SRC_DIR}/maxk.c
- ${BWA_SRC_DIR}/bwtsw2_core.c
- ${BWA_SRC_DIR}/bwtsw2_main.c
- ${BWA_SRC_DIR}/bwtsw2_aux.c
- ${BWA_SRC_DIR}/bwt_lite.c
- ${BWA_SRC_DIR}/bwtsw2_chain.c
- ${BWA_SRC_DIR}/fastmap.c
- ${BWA_SRC_DIR}/bwtsw2_pair.c
- ${BWA_SRC_DIR}/main.c
-)
-
-add_executable(${PROJECT_NAME} ${BWA_SOURCE})
-
-set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME bwa.wasm)
-
-target_compile_definitions(${PROJECT_NAME}
- PRIVATE
- USE_MALLOC_WRAPPERS
- __SSE__ __SSE2__ __SSE4_1__
- _WASI_EMULATED_MMAN _WASI_EMULATED_SIGNAL _WASI_EMULATED_PROCESS_CLOCKS
-)
-
-target_compile_options(${PROJECT_NAME}
- PRIVATE
- -Wno-unused-function
- -Wno-unused-variable
- -msimd128
-)
-
-target_link_options(${PROJECT_NAME}
- PRIVATE
- -Wno-unused-command-line-argument
- LINKER:--allow-undefined,--export=__heap_base,--export=__data_end
- LINKER:-z,stack-size=1048576
-)
-
-target_link_libraries(${PROJECT_NAME} z_wasm wasi-emulated-process-clocks)
-
-add_custom_target(bwa_wasm_opt ALL
- COMMAND
- ${Binaryen_WASM_OPT} -Oz --enable-simd -o bwa.opt.wasm bwa.wasm
- BYPRODUCTS
- ${CMAKE_CURRENT_BINARY_DIR}/bwa.opt.wasm
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-add_dependencies(bwa_wasm_opt ${PROJECT_NAME})
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.txt
deleted file mode 100644
index 5db52a38b..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/CMakeLists.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-project(bwa_wasm)
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-
-################ dependencies ################
-find_package(Python3 REQUIRED)
-find_package(WASISDK 16.0 REQUIRED)
-execute_process(
- COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/../../../test-tools/pick-up-emscripten-headers/collect_files.py --install ../include --loglevel=ERROR
- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
-)
-
-#######################################
-include(ExternalProject)
-
-################ libz ################
-ExternalProject_Add(libz_src
- GIT_REPOSITORY https://github.com/madler/zlib.git
- GIT_TAG 04f42ceca40f73e2978b50e93806c2a18c1281fc
- GIT_PROGRESS ON
- GIT_SHALLOW ON
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libz
- UPDATE_COMMAND ""
- PATCH_COMMAND ""
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
-)
-
-################ bwa ################
-ExternalProject_Add(bwa
- GIT_REPOSITORY https://github.com/lh3/bwa.git
- GIT_TAG 139f68fc4c3747813783a488aef2adc86626b01b
- GIT_PROGRESS ON
- GIT_SHALLOW ON
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bwa
- DEPENDS libz_src
- UPDATE_COMMAND git clean -ffdx && git checkout -- *
- && ${CMAKE_COMMAND} -E echo "Copying pre-installed CMakeLists.txt"
- && ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.bwa_wasm.txt CMakeLists.txt
- && git apply ../bwa.patch
- CONFIGURE_COMMAND ${CMAKE_COMMAND}
- -DWASI_SDK_PREFIX=${WASISDK_HOME}
- -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
- -DCMAKE_SYSROOT=${WASISDK_SYSROOT}
- -DCMAKE_C_FLAGS=-isystem\ ${CMAKE_CURRENT_SOURCE_DIR}/../include/sse\ -isystem\ ${CMAKE_CURRENT_SOURCE_DIR}/../include/libc/musl
- ${CMAKE_CURRENT_SOURCE_DIR}/bwa
- BUILD_COMMAND make bwa_wasm_opt -j 4
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different ./bwa.opt.wasm ${CMAKE_CURRENT_BINARY_DIR}/bwa.wasm
-)
-
-################ bwa data ################
-ExternalProject_Add(bwa-kit
- PREFIX bwa-kit
- URL https://sourceforge.net/projects/bio-bwa/files/bwakit/bwakit-0.7.15_x64-linux.tar.bz2/download
- URL_HASH SHA256=0a7b11971bc7916b68e9df35a364afe77cb3000df02ffb3a6fbd1aff9be5878c
- DOWNLOAD_NAME bwakit-0.7.15_x64-linux.tar.bz2
- DOWNLOAD_EXTRACT_TIMESTAMP ON
- DOWNLOAD_NO_EXTRACT OFF
- DOWNLOAD_NO_PROGRESS ON
- UPDATE_COMMAND ""
- PATCH_COMMAND ""
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_CURRENT_BINARY_DIR}/bwa-kit/src/bwa-kit/resource-GRCh38/hs38DH-extra.fa
- ${CMAKE_CURRENT_BINARY_DIR}/hs38DH-extra.fa
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/README.md
deleted file mode 100644
index a8fbe3e69..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-"bwa" sample introduction
-==============
-
-This sample demonstrates how to build [bwa](https://github.com/lh3/bwa) into
-WebAssembly with simd support and run it with iwasm.
-
-## Preparation
-
-please refer to [installation instructions](../README.md).
-
-## Build
-
-``` shell
-$ mkdir build && cd build
-$ cmake ..
-$ make
-# to verify
-$ ls bwa.wasm
-```
-
-## Download sample data
-
-Download the bwa-0.7.15 binary package from
-[such an address](https://sourceforge.net/projects/bio-bwa/files/bwakit/bwakit-0.7.15_x64-linux.tar.bz2/download),
-a sample data file named **hs38DH.fa** will be used later.
-
-If want more data, please refer to http://hgdownload.cse.ucsc.edu/goldenpath/hg19/bigZips/
-
-## Run workload
-
-Firstly please build iwasm with simd support:
-
-``` shell
-$ cd <wamr dir>/product-mini/platforms/linux/
-$ mkdir build && cd build
-$ cmake ..
-$ make
-```
-
-Then compile wasm file to aot file and run:
-
-``` shell
-$ cd <wamr dir>/samples/workload/bwa/build
-$ <wamr dir>/wamr-compiler/build/wamrc -o bwa.aot bwa.wasm
-$ <wamr dir>/product-mini/platforms/linux/iwasm --dir=. bwa.aot index hs38DH.fa
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/bwa.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/bwa.patch
deleted file mode 100644
index 5599ca319..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/bwa/bwa.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/utils.c b/utils.c
-index 9ceb1be..323299f 100644
---- a/utils.c
-+++ b/utils.c
-@@ -301,6 +301,7 @@ long peakrss(void)
- #ifdef __linux__
- return r.ru_maxrss * 1024;
- #else
-- return r.ru_maxrss;
-+ /*return r.ru_maxrss;*/
-+ return 0;
- #endif
- }
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindBinaryen.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindBinaryen.cmake
deleted file mode 100644
index b4a647861..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindBinaryen.cmake
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-#
-# Output below variables:
-# - Binaryen_HOME. the installation location
-#
-
-include(CMakePrintHelpers)
-include(FindPackageHandleStandardArgs)
-
-file(GLOB Binaryen_SEARCH_PATH "/opt/binaryen*")
-find_path(Binaryen_HOME
- NAMES bin/wasm-opt
- PATHS ${Binaryen_SEARCH_PATH}
- NO_CMAKE_FIND_ROOT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- REQUIRED
-)
-
-execute_process(
- COMMAND ${Binaryen_HOME}/bin/wasm-opt --version
- OUTPUT_VARIABLE WASM_OPT_OUTPUT
- OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
-string(REGEX MATCH version_[0-9]+ Binaryen_VERSION_tmp ${WASM_OPT_OUTPUT})
-string(REGEX MATCH [0-9]+ Binaryen_VERSION ${Binaryen_VERSION_tmp})
-
-#cmake_print_variables(Binaryen_VERSION_tmp Binaryen_VERSION)
-
-find_package_handle_standard_args(Binaryen REQUIRED_VARS Binaryen_HOME VERSION_VAR Binaryen_VERSION)
-
-if(Binaryen_FOUND)
- mark_as_advanced(Binaryen_SEARCH_PATH)
- mark_as_advanced(Binaryen_VERSION_tmp)
- mark_as_advanced(Binaryen_VERSION)
- mark_as_advanced(WASM_OPT_OUTPUT)
-
- set(Binaryen_WASM_OPT ${Binaryen_HOME}/bin/wasm-opt)
-else()
- # TODO: install WASISDK
-endif()
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindWASISDK.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindWASISDK.cmake
deleted file mode 100644
index fff8aea4a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/cmake/FindWASISDK.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-#
-# Output below variables:
-# - WASISDK_HOME. the installation location
-# - WASISDK_SYSROOT. where wasi-sysroot is
-# - WASISDK_TOOLCHAIN. where wasi-sdk.cmake is
-#
-
-include(CMakePrintHelpers)
-include(FindPackageHandleStandardArgs)
-
-file(GLOB WASISDK_SEARCH_PATH "/opt/wasi-sdk-*")
-find_path(WASISDK_HOME
- NAMES share/wasi-sysroot
- PATHS ${WASISDK_SEARCH_PATH}
- NO_CMAKE_FIND_ROOT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- REQUIRED
-)
-
-string(REGEX MATCH [0-9]+\.[0-9]+\.*[0-9]* WASISDK_VERSION ${WASISDK_HOME})
-
-#cmake_print_variables(WASISDK_HOME WASISDK_VERSION)
-find_package_handle_standard_args(WASISDK REQUIRED_VARS WASISDK_HOME VERSION_VAR WASISDK_VERSION)
-
-if(WASISDK_FOUND)
- mark_as_advanced(WASISDK_SEARCH_PATH)
- mark_as_advanced(WASISDK_VERSION)
-
- set(WASISDK_CC_COMMAND ${WASISDK_HOME}/bin/clang)
- set(WASISDK_CXX_COMMAND ${WASISDK_HOME}/bin/clang++)
- set(WASISDK_SYSROOT ${WASISDK_HOME}/share/wasi-sysroot)
- set(WASISDK_TOOLCHAIN ${WASISDK_HOME}/share/cmake/wasi-sdk.cmake)
-else()
- # TODO: install WASISDK
-endif()
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/include/.gitkeep b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/include/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/include/.gitkeep
+++ /dev/null
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/.gitignore
deleted file mode 100644
index dd97754d4..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build
-meshoptimizer \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/CMakeLists.txt
deleted file mode 100644
index d6a1c358a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-project(bench-meshoptimizer)
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-
-################ dependencies ################
-find_package(Python3 REQUIRED)
-find_package(WASISDK 16.0 REQUIRED)
-execute_process(
- COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/../../../test-tools/pick-up-emscripten-headers/collect_files.py --install ../include --loglevel=ERROR
- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
-)
-
-################ MESHOPTIMIZER ################
-include(ExternalProject)
-
-ExternalProject_Add(codecbench
- PREFIX codecbench
- GIT_REPOSITORY https://github.com/zeux/meshoptimizer.git
- GIT_TAG f734fd572aed5bf76e84d9ed62ca6f4f6c47d84e
- GIT_SHALLOW OFF
- GIT_PROGRESS ON
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/meshoptimizer
- UPDATE_COMMAND git clean -fd && git checkout -- *
- && ${CMAKE_COMMAND} -E echo "Applying patch"
- && git apply ${CMAKE_CURRENT_SOURCE_DIR}/codecbench.patch
- CONFIGURE_COMMAND ${CMAKE_COMMAND}
- -DWASI_SDK_PREFIX=${WASISDK_HOME}
- -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
- -DCMAKE_SYSROOT=${WASISDK_SYSROOT}
- ${CMAKE_CURRENT_SOURCE_DIR}/meshoptimizer
- BUILD_COMMAND make codecbench -j 4
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different ./codecbench.wasm ${CMAKE_CURRENT_BINARY_DIR}/codecbench.wasm
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md
deleted file mode 100644
index 466cd8759..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-"codecbench of meshoptimizer" sample introduction
-==============
-
-This sample demonstrates how to build [codecbench of messoptimizer](https://github.com/zeux/meshoptimizer) into
-WebAssembly with simd support and run it with iwasm.
-
-## Preparation
-
-please refer to [installation instructions](../README.md).
-
-## Build with wasi-sdk
-
-``` shell
-$ mkdir build && cd build
-$ cmake ..
-$ make
-# to verify
-$ ls codecbench.wasm
-```
-
-## Or build with EMSDK
-
-EMSDK is another toolchain to compile C/C++ code to WASM. In this case, the output wasm file
-might have a higher performance than the file generated by wasi-sdk.
-
-``` shell
-$ git clone https://github.com/zeux/meshoptimizer.git
-$ cd messoptimizer
-$ em++ tools/codecbench.cpp src/vertexcodec.cpp src/vertexfilter.cpp \
- src/overdrawanalyzer.cpp src/indexgenerator.cpp src/vcacheoptimizer.cpp \
- src/clusterizer.cpp src/indexcodec.cpp src/vfetchanalyzer.cpp \
- src/spatialorder.cpp src/allocator.cpp src/vcacheanalyzer.cpp \
- src/vfetchoptimizer.cpp src/overdrawoptimizer.cpp src/simplifier.cpp \
- src/stripifier.cpp -O3 -msimd128 \
- -s TOTAL_MEMORY=268435456 \
- -o codecbench.wasm
-$ ls -l codecbench.wasm
-```
-
-## Run workload
-
-Firstly please build iwasm with simd support:
-
-``` shell
-$ cd <wamr dir>/product-mini/platforms/linux/
-$ mkdir build && cd build
-$ cmake ..
-$ make
-```
-
-Then compile wasm file to aot file and run:
-
-``` shell
-$ <wamr dir>/wamr-compiler/build/wamrc -o codecbench.aot codecbench.wasm
-$ <wamr dir>/product-mini/platforms/linux/build/iwasm codecbench.aot
-```
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/codecbench.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/codecbench.patch
deleted file mode 100644
index 19db792bf..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/codecbench.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 612cf3b..22a365a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -158,3 +158,43 @@ install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/meshoptimizerConfigVersion.cmake
- COMPONENT meshoptimizer
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/meshoptimizer)
-+
-+##################################################
-+# codecbench
-+##################################################
-+add_executable(codecbench tools/codecbench.cpp ${SOURCES})
-+
-+set_target_properties(codecbench PROPERTIES OUTPUT_NAME codecbench.wasm)
-+
-+target_compile_options(codecbench
-+ PUBLIC
-+ -O3 -msimd128
-+ -std=c++11
-+ -Wno-unused-function
-+ -Wno-unused-variable
-+)
-+
-+target_link_options(codecbench
-+ PUBLIC
-+ LINKER:-allow-undefined,--demangle,--export=malloc,--export=free
-+)
-+
-+find_program(WASM_OPT
-+ NAMES wasm-opt
-+ PATHS /opt/binaryen-version_97/bin /opt/binaryen/bin
-+)
-+
-+if (NOT WASM_OPT)
-+ message(WARNING "can not find wasm-opt and will not optimize any wasm module")
-+endif()
-+
-+add_custom_target(codecbench.opt ALL
-+ COMMAND
-+ ${WASM_OPT} -Oz --enable-simd -o codecbench.opt.wasm codecbench.wasm
-+ BYPRODUCTS
-+ ${CMAKE_CURRENT_BINARY_DIR}/codecbench.opt.wasm
-+ WORKING_DIRECTORY
-+ ${CMAKE_CURRENT_BINARY_DIR}
-+)
-+
-+add_dependencies(codecbench.opt codecbench)
-diff --git a/src/vertexcodec.cpp b/src/vertexcodec.cpp
-index 4bd1112..257c258 100644
---- a/src/vertexcodec.cpp
-+++ b/src/vertexcodec.cpp
-@@ -89,13 +89,13 @@
- #endif
-
- #ifdef SIMD_WASM
--#define wasmx_splat_v32x4(v, i) wasm_v32x4_shuffle(v, v, i, i, i, i)
--#define wasmx_unpacklo_v8x16(a, b) wasm_v8x16_shuffle(a, b, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23)
--#define wasmx_unpackhi_v8x16(a, b) wasm_v8x16_shuffle(a, b, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31)
--#define wasmx_unpacklo_v16x8(a, b) wasm_v16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11)
--#define wasmx_unpackhi_v16x8(a, b) wasm_v16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15)
--#define wasmx_unpacklo_v64x2(a, b) wasm_v64x2_shuffle(a, b, 0, 2)
--#define wasmx_unpackhi_v64x2(a, b) wasm_v64x2_shuffle(a, b, 1, 3)
-+#define wasmx_splat_v32x4(v, i) wasm_i32x4_shuffle(v, v, i, i, i, i)
-+#define wasmx_unpacklo_v8x16(a, b) wasm_i8x16_shuffle(a, b, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23)
-+#define wasmx_unpackhi_v8x16(a, b) wasm_i8x16_shuffle(a, b, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31)
-+#define wasmx_unpacklo_v16x8(a, b) wasm_i16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11)
-+#define wasmx_unpackhi_v16x8(a, b) wasm_i16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15)
-+#define wasmx_unpacklo_v64x2(a, b) wasm_i64x2_shuffle(a, b, 0, 2)
-+#define wasmx_unpackhi_v64x2(a, b) wasm_i64x2_shuffle(a, b, 1, 3)
- #endif
-
- namespace meshopt
-@@ -757,7 +757,7 @@ static v128_t decodeShuffleMask(unsigned char mask0, unsigned char mask1)
- v128_t sm1 = wasm_v128_load(&kDecodeBytesGroupShuffle[mask1]);
-
- v128_t sm1off = wasm_v128_load(&kDecodeBytesGroupCount[mask0]);
-- sm1off = wasm_v8x16_shuffle(sm1off, sm1off, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-+ sm1off = wasm_i8x16_shuffle(sm1off, sm1off, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-
- v128_t sm1r = wasm_i8x16_add(sm1, sm1off);
-
-@@ -807,7 +807,7 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
-
- v128_t shuf = decodeShuffleMask(mask0, mask1);
-
-- v128_t result = wasm_v128_bitselect(wasm_v8x16_swizzle(rest, shuf), sel, mask);
-+ v128_t result = wasm_v128_bitselect(wasm_i8x16_swizzle(rest, shuf), sel, mask);
-
- wasm_v128_store(buffer, result);
-
-@@ -829,7 +829,7 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
-
- v128_t shuf = decodeShuffleMask(mask0, mask1);
-
-- v128_t result = wasm_v128_bitselect(wasm_v8x16_swizzle(rest, shuf), sel, mask);
-+ v128_t result = wasm_v128_bitselect(wasm_i8x16_swizzle(rest, shuf), sel, mask);
-
- wasm_v128_store(buffer, result);
-
-diff --git a/src/vertexfilter.cpp b/src/vertexfilter.cpp
-index 5c7589c..c79cad4 100644
---- a/src/vertexfilter.cpp
-+++ b/src/vertexfilter.cpp
-@@ -57,10 +57,10 @@
- #endif
-
- #ifdef SIMD_WASM
--#define wasmx_unpacklo_v16x8(a, b) wasm_v16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11)
--#define wasmx_unpackhi_v16x8(a, b) wasm_v16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15)
--#define wasmx_unziplo_v32x4(a, b) wasm_v32x4_shuffle(a, b, 0, 2, 4, 6)
--#define wasmx_unziphi_v32x4(a, b) wasm_v32x4_shuffle(a, b, 1, 3, 5, 7)
-+#define wasmx_unpacklo_v16x8(a, b) wasm_i16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11)
-+#define wasmx_unpackhi_v16x8(a, b) wasm_i16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15)
-+#define wasmx_unziplo_v32x4(a, b) wasm_i32x4_shuffle(a, b, 0, 2, 4, 6)
-+#define wasmx_unziphi_v32x4(a, b) wasm_i32x4_shuffle(a, b, 1, 3, 5, 7)
- #endif
-
- #ifndef __has_builtin
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/preparation.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/preparation.sh
deleted file mode 100755
index 47b11ac56..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/preparation.sh
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-readonly BUILD_CONTENT="/tmp/build_content"
-readonly WABT_VER=1.0.31
-readonly WABT_FILE="wabt-${WABT_VER}-ubuntu.tar.gz"
-readonly CMAKE_VER=3.25.1
-readonly CMAKE_FILE="cmake-${CMAKE_VER}-Linux-x86_64.sh"
-readonly BINARYEN_VER=version_111
-readonly BINARYEN_FILE="binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz"
-readonly BAZEL_VER=6.0.0
-readonly BAZEL_FILE=bazel-${BAZEL_VER}-installer-linux-x86_64.sh
-
-function DEBUG() {
- env | grep -q "\<DEBUG\>"
-}
-
-#
-# install dependency
-function install_deps() {
- apt update
- apt install -y lsb-release wget software-properties-common \
- build-essential git tree zip unzip
-}
-
-#
-# install wabt
-function install_wabt() {
- if [[ ! -f ${WABT_FILE} ]]; then
- wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/${WABT_FILE}
- fi
-
- tar zxf ${WABT_FILE} -C /opt
- ln -sf /opt/wabt-${WABT_VER} /opt/wabt
-}
-
-#
-# install cmake
-function install_cmake() {
- if [[ ! -f cmake-${CMAKE_VER}-Linux-x86_64.sh ]]; then
- wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/${CMAKE_FILE}
- fi
-
- chmod a+x ${CMAKE_FILE}
- mkdir /opt/cmake
- ./${CMAKE_FILE} --prefix=/opt/cmake --skip-license
- ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
-}
-
-#
-# install emsdk
-function install_emsdk() {
- cd /opt
- git clone https://github.com/emscripten-core/emsdk.git
- cd emsdk
- git pull
- ./emsdk install 3.1.28
- ./emsdk activate 3.1.28
- echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc
-}
-
-#
-# install binaryen
-function install_binaryen() {
- if [[ ! -f ${BINARYEN_FILE} ]]; then
- wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/${BINARYEN_FILE}
- fi
-
- tar zxf ${BINARYEN_FILE} -C /opt
- ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
-}
-
-#
-# install bazel
-function install_bazel() {
- if [[ ! -f ${BAZEL_FILE} ]]; then
- wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_FILE}
- fi
-
- chmod a+x ${BAZEL_FILE}
- ./${BAZEL_FILE}
-}
-
-#
-# MAIN
-DEBUG && set -xevu
-if [[ ! -d ${BUILD_CONTENT} ]]; then
- mkdir ${BUILD_CONTENT}
-fi
-
-cd ${BUILD_CONTENT} || exit
-if DEBUG; then
- "$@"
-else
- install_deps \
- && install_bazel \
- && install_binaryen \
- && install_cmake \
- && install_emsdk \
- && install_wabt \
- && install_wasi-sdk
-fi
-cd - > /dev/null || exit
-DEBUG && set +xevu
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/README.md
deleted file mode 100644
index 7bc7dd259..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-"tensorflow" sample introduction
-==============
-
-This sample demonstrates how to build [tensorflow](https://github.com/tensorflow/tensorflow) into WebAssembly with emsdk toolchain and run it with iwasm.:
-```bash
-./build.sh
-# for linux platform, or
-./build.sh --threads
-# for multi-threading on linux platform
-./build.sh --sgx
-# for linux-sgx platform
-```
-to build tensorflow and run it with iwasm, which basically contains the following steps:
-- clone emsdk under `<wamr_dir>/core/deps`, install and activate 2.0.26
-- hack emcc to delete some objects in libc.a
-- build tf-lite with emcc compiler
-- build iwasm with lib-pthread and libc-emcc enabled
-- run benchmark model with iwasm:
- --max-secs 300: means the max training time cost is 5 minutes, you can adjust it by yourself
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/build.sh
deleted file mode 100755
index 6df8db423..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/build.sh
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-####################################
-# build tensorflow-lite sample #
-####################################
-BUILD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-
-WAMR_DIR="${BUILD_SCRIPT_DIR}/../../.."
-WAMR_PLATFORM_DIR="${WAMR_DIR}/product-mini/platforms"
-WAMRC_DIR="${WAMR_DIR}/wamr-compiler"
-CORE_DEPS_DIR="${WAMR_DIR}/core/deps"
-EMSDK_DIR="${CORE_DEPS_DIR}/emsdk"
-
-EMSDK_WASM_DIR="${EMSDK_DIR}/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten"
-OUT_DIR="${BUILD_SCRIPT_DIR}/out"
-TENSORFLOW_DIR="${BUILD_SCRIPT_DIR}/tensorflow"
-TF_LITE_BUILD_DIR="${TENSORFLOW_DIR}/tensorflow/lite/tools/make"
-
-function Clear_Before_Exit()
-{
- [[ -f ${TENSORFLOW_DIR}/tf_lite.patch ]] &&
- rm -f ${TENSORFLOW_DIR}/tf_lite.patch
- # resume the libc.a under EMSDK_WASM_DIR
- cd ${EMSDK_WASM_DIR}
- mv libc.a.bak libc.a
-}
-
-set -xe
-
-# 1.clone emsdk
-cd ${CORE_DEPS_DIR}
-rm -fr emsdk
-git clone https://github.com/emscripten-core/emsdk.git
-cd emsdk
-./emsdk install 2.0.26
-./emsdk activate 2.0.26
-source emsdk_env.sh
-
-# 2.hack emcc
-cd ${EMSDK_WASM_DIR}
-# back up libc.a
-cp libc.a libc.a.bak
-# delete some objects in libc.a
-emar d libc.a open.o
-emar d libc.a mmap.o
-emar d libc.a munmap.o
-emar d libc.a library_pthread_stub.o
-emar d libc.a pthread_self.o
-emranlib libc.a
-
-# 3. build tf-lite
-cd ${BUILD_SCRIPT_DIR}
-# 3.1 clone tf repo from Github and checkout to 2303ed commit
-if [ ! -d "tensorflow" ]; then
- git clone https://github.com/tensorflow/tensorflow.git
-fi
-
-cd ${TENSORFLOW_DIR}
-git checkout 2303ed4bdb344a1fc4545658d1df6d9ce20331dd
-
-# 3.2 copy the tf-lite.patch to tensorflow_root_dir and apply it
-cd ${TENSORFLOW_DIR}
-cp ${BUILD_SCRIPT_DIR}/tf_lite.patch .
-git checkout tensorflow/lite/tools/make/Makefile
-git checkout tensorflow/lite/tools/make/targets/linux_makefile.inc
-
-if [[ $(git apply tf_lite.patch 2>&1) =~ "error" ]]; then
- echo "git apply patch failed, please check tf-lite related changes..."
- Clear_Before_Exit
- exit 0
-fi
-
-cd ${TF_LITE_BUILD_DIR}
-# 3.3 download dependencies
-if [ ! -d "${TF_LITE_BUILD_DIR}/downloads" ]; then
- source download_dependencies.sh
-fi
-
-# 3.4 build tf-lite target
-if [ -d "${TF_LITE_BUILD_DIR}/gen" ]; then
- rm -fr ${TF_LITE_BUILD_DIR}/gen
-fi
-
-make -j 4 -C "${TENSORFLOW_DIR}" -f ${TF_LITE_BUILD_DIR}/Makefile
-
-# remove patch file and recover emcc libc.a after building
-Clear_Before_Exit
-
-# 3.5 copy /make/gen target files to out/
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-cp -r ${TF_LITE_BUILD_DIR}/gen/linux_x86_64/bin/. ${OUT_DIR}/
-
-# 4. compile tf-model.wasm to tf-model.aot with wamrc
-# 4.1 build wamr-compiler
-cd ${WAMRC_DIR}
-./build_llvm.sh
-rm -fr build && mkdir build
-cd build && cmake ..
-make
-# 4.2 compile tf-mode.wasm to tf-model.aot
-WAMRC_CMD="$(pwd)/wamrc"
-cd ${OUT_DIR}
-if [[ $1 == '--sgx' ]]; then
- ${WAMRC_CMD} -sgx -o benchmark_model.aot benchmark_model.wasm
-elif [[ $1 == '--threads' ]]; then
- ${WAMRC_CMD} --enable-multi-thread -o benchmark_model.aot benchmark_model.wasm
-else
- ${WAMRC_CMD} -o benchmark_model.aot benchmark_model.wasm
-fi
-
-# 5. build iwasm with pthread and libc_emcc enable
-# platform:
-# linux by default
-# linux-sgx if $1 equals '--sgx'
-if [[ $1 == '--sgx' ]]; then
- cd ${WAMR_PLATFORM_DIR}/linux-sgx
- rm -fr build && mkdir build
- cd build && cmake .. -DWAMR_BUILD_LIBC_EMCC=1
- make
- cd ../enclave-sample
- make
-else
- cd ${WAMR_PLATFORM_DIR}/linux
- rm -fr build && mkdir build
- cd build && cmake .. -DWAMR_BUILD_LIB_PTHREAD=1 -DWAMR_BUILD_LIBC_EMCC=1
- make
-fi
-
-# 6. run tensorflow with iwasm
-cd ${OUT_DIR}
-# 6.1 download tf-lite model
-wget "https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip"
-unzip mobilenet_v1_224_android_quant_2017_11_08.zip
-
-# 6.2 run tf-lite model with iwasm
-echo "---> run tensorflow benchmark model with iwasm"
-if [[ $1 == '--sgx' ]]; then
- IWASM_CMD="${WAMR_PLATFORM_DIR}/linux-sgx/enclave-sample/iwasm"
-else
- IWASM_CMD="${WAMR_PLATFORM_DIR}/linux/build/iwasm"
-fi
-
-if [[ $1 == '--threads' ]]; then
- ${IWASM_CMD} --heap-size=10475860 \
- benchmark_model.aot --num_threads=4 \
- --graph=mobilenet_quant_v1_224.tflite --max_secs=300
-else
- ${IWASM_CMD} --heap-size=10475860 \
- benchmark_model.aot \
- --graph=mobilenet_quant_v1_224.tflite --max_secs=300
-fi
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/tf_lite.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/tf_lite.patch
deleted file mode 100644
index b6224d581..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/tensorflow/tf_lite.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile
-index c7ddff58440..ebfebaead35 100644
---- a/tensorflow/lite/tools/make/Makefile
-+++ b/tensorflow/lite/tools/make/Makefile
-@@ -48,11 +48,7 @@ INCLUDES += -I/usr/local/include
-
- # These are the default libraries needed, but they can be added to or
- # overridden by the platform-specific settings in target makefiles.
--LIBS := \
---lstdc++ \
---lpthread \
---lm \
---lz \
-+LIBS := -lm \
- -ldl
-
- # There are no rules for compiling objects for the host system (since we don't
-@@ -84,14 +80,24 @@ endif # ifeq ($(HOST_ARCH),$(TARGET_ARCH))
- endif # ifeq ($(HOST_OS),$(TARGET))
- endif
-
-+CFLAGS+=-msimd128 -mbulk-memory -matomics
-+CXXFLAGS+=-msimd128 -mbulk-memory -matomics
-+
-+LIBFLAGS += -s TOTAL_STACK=1048576 -s MALLOC="none" \
-+ -s INITIAL_MEMORY=16777216 \
-+ -s MAXIMUM_MEMORY=167772160 \
-+ -s ALLOW_MEMORY_GROWTH=1 \
-+ -Wl,--export=__data_end -Wl,--export=__heap_base,--shared-memory,--no-check-features \
-+ -s ERROR_ON_UNDEFINED_SYMBOLS=0
-+
- # This library is the main target for this makefile. It will contain a minimal
- # runtime that can be linked in to other programs.
- LIB_NAME := libtensorflow-lite.a
-
- # Benchmark static library and binary
- BENCHMARK_LIB_NAME := benchmark-lib.a
--BENCHMARK_BINARY_NAME := benchmark_model
--BENCHMARK_PERF_OPTIONS_BINARY_NAME := benchmark_model_performance_options
-+BENCHMARK_BINARY_NAME := benchmark_model.wasm
-+BENCHMARK_PERF_OPTIONS_BINARY_NAME := benchmark_model_performance_options.wasm
-
- # A small example program that shows how to link against the library.
- MINIMAL_SRCS := \
-@@ -277,12 +283,16 @@ LIB_PATH := $(LIBDIR)$(LIB_NAME)
- BENCHMARK_LIB := $(LIBDIR)$(BENCHMARK_LIB_NAME)
- BENCHMARK_BINARY := $(BINDIR)$(BENCHMARK_BINARY_NAME)
- BENCHMARK_PERF_OPTIONS_BINARY := $(BINDIR)$(BENCHMARK_PERF_OPTIONS_BINARY_NAME)
--MINIMAL_BINARY := $(BINDIR)minimal
-+MINIMAL_BINARY := $(BINDIR)minimal.wasm
- LABEL_IMAGE_BINARY := $(BINDIR)label_image
-
--CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
--CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
--AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
-+# CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
-+# CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
-+# AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
-+
-+CXX := em++
-+CC := emcc
-+AR := emar
-
- MINIMAL_OBJS := $(addprefix $(OBJDIR), \
- $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(MINIMAL_SRCS))))
-diff --git a/tensorflow/lite/tools/make/targets/linux_makefile.inc b/tensorflow/lite/tools/make/targets/linux_makefile.inc
-index 222cef9e5ff..eea89a38f01 100644
---- a/tensorflow/lite/tools/make/targets/linux_makefile.inc
-+++ b/tensorflow/lite/tools/make/targets/linux_makefile.inc
-@@ -2,12 +2,10 @@
- ifeq ($(TARGET), linux)
- CXXFLAGS += \
- -fPIC \
-- -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-- -pthread
-+ -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
- CFLAGS += \
- -fPIC \
-- -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-- -pthread
-+ -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
- # TODO(petewarden): In the future we may want to add architecture-specific
- # flags like -msse4.2
- LIBS += -ldl
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/.gitignore
deleted file mode 100644
index e8bec70e4..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# from CMakeLists
-av1
-build
-include
-
-# from build.sh
-wasm-av1
-out
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.avx_wasm.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.avx_wasm.txt
deleted file mode 100644
index 409665b3c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.avx_wasm.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-project(testavx)
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake)
-
-################ dependencies ################
-find_package(Binaryen 111 REQUIRED)
-
-################ AOM ################
-set(ENABLE_CCACHE ON)
-set(ENABLE_DOCS OFF CACHE BOOL "ENABLE_DOCS" FORCE)
-set(ENABLE_EXAMPLES OFF CACHE BOOL "ENABLE_EXAMPLES" FORCE)
-set(ENABLE_NEON OFF CACHE BOOL "ENABLE_EXAMPLES" FORCE)
-set(ENABLE_NEON_ASM OFF CACHE BOOL "ENABLE_EXAMPLES" FORCE)
-set(ENABLE_VSX OFF CACHE BOOL "ENABLE_EXAMPLES" FORCE)
-set(ENABLE_MMX OFF CACHE BOOL "ENABLE_EXAMPLES" FORCE)
-set(AOM_TARGET_CPU generic)
-set(CONFIG_ACCOUNTING 1 CACHE NUMBER "" FORCE)
-set(CONFIG_INSPECTION 1 CACHE NUMBER "" FORCE)
-set(CONFIG_MULTITHREAD 0 CACHE NUMBER "" FORCE)
-set(CONFIG_RUNTIME_CPU_DETECT 0 CACHE NUMBER "" FORCE)
-set(CONFIG_UNIT_TESTS 0 CACHE NUMBER "" FORCE)
-set(CONFIG_WEBM_IO 0 CACHE NUMBER "" FORCE)
-add_subdirectory(third_party/aom third_party/aom/bin EXCLUDE_FROM_ALL)
-
-################ AV ################
-add_executable(${PROJECT_NAME}
- test.c
- decode-av1.c
-)
-
-target_include_directories(${PROJECT_NAME}
- PRIVATE
- third_party/aom/
- ${CMAKE_CURRENT_BINARY_DIR}/third_party/aom/bin
-)
-
-set_target_properties(${PROJECT_NAME}
- PROPERTIES
- OUTPUT_NAME ${PROJECT_NAME}.wasm
-)
-
-target_link_options(${PROJECT_NAME}
- PRIVATE
- LINKER:--allow-undefined
- LINKER:--export=__heap_base
- LINKER:--export=__data_end
- LINKER:--initial-memory=33554432
- LINKER:-z,stack-size=25165824
-)
-
-target_link_libraries(${PROJECT_NAME}
- PRIVATE
- aom
-)
-
-add_dependencies(${PROJECT_NAME} aom)
-
-add_custom_target(${PROJECT_NAME}_opt ALL
- COMMAND
- ${Binaryen_WASM_OPT} -Oz --enable-simd -o ${PROJECT_NAME}.opt.wasm ${PROJECT_NAME}.wasm
- BYPRODUCTS
- ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.opt.wasm
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-add_dependencies(${PROJECT_NAME}_opt ${PROJECT_NAME})
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.txt
deleted file mode 100644
index 3d263bfbe..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-project(av1_wasm)
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-
-################ dependencies ################
-find_package(Python3 REQUIRED)
-find_package(WASISDK 16.0 REQUIRED)
-execute_process(
- COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/../../../test-tools/pick-up-emscripten-headers/collect_files.py --install ../include --loglevel=ERROR
- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
-)
-
-#######################################
-include(ExternalProject)
-
-################ av1 ################
-ExternalProject_Add(av1
- PREFIX av1
- GIT_REPOSITORY https://github.com/GoogleChromeLabs/wasm-av1.git
- GIT_TAG master
- GIT_PROGRESS ON
- GIT_SHALLOW ON
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/av1
- UPDATE_COMMAND git clean -fd && git checkout -- *
- && ${CMAKE_COMMAND} -E echo "Copying pre-installed CMakeLists.txt"
- && ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.avx_wasm.txt CMakeLists.txt
- && git apply ../av1-clang.patch
- CONFIGURE_COMMAND ${CMAKE_COMMAND}
- -DWASI_SDK_PREFIX=${WASISDK_HOME}
- -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
- -DCMAKE_SYSROOT=${WASISDK_SYSROOT}
- -DCMAKE_C_FLAGS=-isystem\ ${CMAKE_CURRENT_SOURCE_DIR}/../include/sse\ -isystem\ ${CMAKE_CURRENT_SOURCE_DIR}/../include/libc/musl
- ${CMAKE_CURRENT_SOURCE_DIR}/av1
- BUILD_COMMAND make testavx_opt -j 4
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different
- testavx.opt.wasm
- ${CMAKE_CURRENT_SOURCE_DIR}/av1/third_party/samples/elephants_dream_480p24.ivf
- ${CMAKE_CURRENT_BINARY_DIR}
-)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/README.md
deleted file mode 100644
index 2166fe6ae..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-"wasm-av1" sample introduction
-==============
-
-This sample demonstrates how to build [wasm-av1](https://github.com/GoogleChromeLabs/wasm-av1) into
-WebAssembly with simd support and run it with iwasm.
-
-## Preparation
-
-please refer to [installation instructions](../README.md).
-
-## Build with wasi-sdk
-
-``` shell
-$ mkdir build && cd build
-$ cmake ..
-$ make
-# to verify
-$ ls testavx.wasm
-```
-
-## Or build with EMSDK
-
-just run the convenience script:
-
-```bash
-./build.sh
-```
-
-the script builds wasm-av1 and runs it with iwasm, which basically contains the following steps:
-- hack emcc to delete some objects in libc.a
-- patch wasm-av1 and build it with emcc compiler
-- build iwasm with simd and libc-emcc support
-- run testav1.aot with iwasm
-
-### Run workload
-
-Firstly please build iwasm with simd support:
-
-``` shell
-$ cd <wamr dir>/product-mini/platforms/linux/
-$ mkdir build && cd build
-$ cmake .. -DWAMR_BUILD_LIBC_EMCC=1
-$ make
-```
-
-Then compile wasm file to aot file and run:
-
-``` shell
-$ cd <dir of testavx.wasm>
-$ <wamr dir>/wamr-compiler/build/wamrc -o testavx.aot testavx.wasm
-# copy sample data like <wamr dir>/samples/workload/wasm-av1/av1/third_party/samples/elephants_dream_480p24.ivf
-# make sure you declare the access priority of the directory in which the sample data is
-$ <wamr dir>/product-mini/platforms/linux/build/iwasm --dir=. testavx.aot elephants_dream_480p24.ivf
-```
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/av1-clang.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/av1-clang.patch
deleted file mode 100644
index 97e795482..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/av1-clang.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/test.c b/test.c
-index df2d44b..520bf13 100644
---- a/test.c
-+++ b/test.c
-@@ -63,9 +63,14 @@ main(int argc, char *argv[]) {
- static int i = 0;
-
- ++i;
-+ printf("Decoding frame #%d\n", i);
- if (30 <= i && i < 40) {
-+ printf("Dumping frame #%d\n", i);
- dump_raw_frame(af, i);
- }
-+ if (i >= 1000) {
-+ break;
-+ }
- }
- /*
- * Run the decoder every time, so that we keep
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/build.sh
deleted file mode 100755
index efa17eca6..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/build.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-####################################
-# build wasm-av1 sample #
-####################################
-if [ ! -d "${EMSDK}" ]; then
- echo "can not find emsdk. "
- echo "please refer to https://emscripten.org/docs/getting_started/downloads.html "
- echo "to install it, or active it by 'source <emsdk_dir>emsdk_env.sh'"
- exit
-fi
-
-set -xe
-
-EMSDK_WASM_DIR="${EMSDK}/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten"
-BUILD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-OUT_DIR="${BUILD_SCRIPT_DIR}/out"
-WASM_AV1_DIR="${BUILD_SCRIPT_DIR}/wasm-av1"
-
-WAMR_PLATFORM_DIR="${BUILD_SCRIPT_DIR}/../../../product-mini/platforms"
-IWASM_CMD="${WAMR_PLATFORM_DIR}/linux/build/iwasm"
-
-WAMRC_DIR="${BUILD_SCRIPT_DIR}/../../../wamr-compiler"
-WAMRC_CMD="${WAMRC_DIR}/build/wamrc"
-
-function Clear_Before_Exit
-{
- [[ -f ${WASM_AV1_DIR}/wasm-av1.patch ]] &&
- rm -f ${WASM_AV1_DIR}/wasm-av1.patch
- # resume the libc.a under EMSDK_WASM_DIR
- cd ${EMSDK_WASM_DIR}
- mv libc.a.bak libc.a
-}
-
-# 1.hack emcc
-cd ${EMSDK_WASM_DIR}
-# back up libc.a
-cp libc.a libc.a.bak
-# delete some objects in libc.a
-emar d libc.a fopen.o
-emar d libc.a fread.o
-emar d libc.a feof.o
-emar d libc.a fclose.o
-
-# 2. build wasm-av1
-cd ${BUILD_SCRIPT_DIR}
-# 2.1 clone wasm-av1 repo from Github
-if [ ! -d "wasm-av1" ]; then
- git clone https://github.com/GoogleChromeLabs/wasm-av1.git
-fi
-
-# 2.2 copy the wasm-av1.patch to wasm-av1 and apply the patch
-cd ${WASM_AV1_DIR}
-cp -a ${BUILD_SCRIPT_DIR}/wasm-av1.patch .
-git checkout Makefile
-git checkout test.c
-git checkout third_party/aom
-
-if [[ $(git apply wasm-av1.patch 2>&1) =~ "error" ]]; then
- echo "git apply patch failed, please check wasm-av1 related changes..."
- Clear_Before_Exit
- exit 0
-fi
-
-make testavx -j 4
-
-# remove patch file and recover emcc libc.a after building
-Clear_Before_Exit
-
-# 2.3 copy /make/gen target files to out/
-rm -rf ${OUT_DIR} && mkdir ${OUT_DIR}
-cp -a ${WASM_AV1_DIR}/testavx.wasm ${OUT_DIR}/
-
-# 3. compile wasm-av1.wasm to wasm-av1.aot with wamrc
-# 3.1 build wamr-compiler
-cd ${WAMRC_DIR}
-./build_llvm.sh
-rm -fr build && mkdir build
-cd build && cmake ..
-make
-# 3.2 compile wasm-av1.wasm to wasm-av1.aot
-cd ${OUT_DIR}
-${WAMRC_CMD} -o testavx.aot testavx.wasm
-
-# 4. build iwasm with pthread and libc_emcc enable
-cd ${WAMR_PLATFORM_DIR}/linux
-rm -fr build && mkdir build
-cd build && cmake .. -DWAMR_BUILD_LIB_PTHREAD=1 -DWAMR_BUILD_LIBC_EMCC=1
-make
-
-# 5. run wasm-av1 with iwasm
-echo "---> run testav1.aot with iwasm"
-cd ${OUT_DIR}
-${IWASM_CMD} testavx.aot ../wasm-av1/third_party/samples/elephants_dream_480p24.ivf
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/wasm-av1.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/wasm-av1.patch
deleted file mode 100644
index 98f262562..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/wasm-av1/wasm-av1.patch
+++ /dev/null
@@ -1,701 +0,0 @@
-diff --git a/Makefile b/Makefile
-index c39fff6..4682d43 100644
---- a/Makefile
-+++ b/Makefile
-@@ -59,11 +59,13 @@ $(TARGET): $(DEPS) blob-api.c yuv-to-rgb.c $(EMLIBAV1)
- ]" \
- blob-api.c yuv-to-rgb.c $(SRCS) $(INC) -L $(LIBDIR) -l$(LIB)
-
--$(TESTTARGET): test.c $(DEPS) $(X86LIBAV1)
-- cc -o $@ -O3 test.c $(SRCS) $(INC) -L $(X86LIBDIR) -l$(LIB)
-+$(TESTTARGET): test.c $(DEPS) $(EMLIBAV1)
-+ emcc -o $@.wasm -O3 test.c $(SRCS) $(INC) -L $(LIBDIR) -l$(LIB) \
-+ -s TOTAL_MEMORY=104857600 -s ERROR_ON_UNDEFINED_SYMBOLS=0
-
--$(TESTTARGET)g: test.c $(DEPS) $(X86LIBAV1)
-- cc -o $@ -g test.c $(SRCS) $(INC) -L $(X86LIBDIR) -l$(LIB)
-+$(TESTTARGET)g: test.c $(DEPS) $(EMLIBAV1)
-+ emcc -o $@.wasm -g test.c $(SRCS) $(INC) -L $(LIBDIR) -l$(LIB) \
-+ -s TOTAL_MEMORY=104857600 -s ERROR_ON_UNDEFINED_SYMBOLS=0
-
- clean:
- -rm $(TARGET) $(TESTTARGET) $(TESTTARGET)g
-@@ -80,7 +82,7 @@ $(EMLIBAV1): $(LIBDIR)
- -DCONFIG_RUNTIME_CPU_DETECT=0 \
- -DCONFIG_UNIT_TESTS=0 \
- -DCONFIG_WEBM_IO=0 \
-- -DCMAKE_TOOLCHAIN_FILE=`../../get-emcmake.sh`; \
-+ -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake; \
- make \
- )
-
-diff --git a/test.c b/test.c
-index df2d44b..cb270de 100644
---- a/test.c
-+++ b/test.c
-@@ -18,6 +18,9 @@
-
- #include "decode-av1-priv.h"
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- static void
- dump_raw_frame(AVX_Video_Frame *avf, int id) {
- FILE *f;
-@@ -26,12 +29,13 @@ dump_raw_frame(AVX_Video_Frame *avf, int id) {
- void *buf;
-
- sprintf(name, "frame%04d.yuv", id);
-+ printf("writing %s ..\n", name);
- if ((f = fopen(name, "wb")) == NULL) {
- return;
- }
- buf = AVX_Video_Frame_get_buffer(avf);
- size = AVX_Video_Frame_get_size(avf);
-- fwrite(buf, size, 1, f);
-+ emcc_fwrite(buf, size, 1, f);
- fclose(f);
- }
-
-@@ -63,9 +67,12 @@ main(int argc, char *argv[]) {
- static int i = 0;
-
- ++i;
-+ printf("##decode raw frame %d\n", i);
- if (30 <= i && i < 40) {
- dump_raw_frame(af, i);
- }
-+ if (i >= 1000)
-+ break;
- }
- /*
- * Run the decoder every time, so that we keep
-diff --git a/third_party/aom/CMakeLists.txt b/third_party/aom/CMakeLists.txt
-index 9dbe301..20c7be4 100644
---- a/third_party/aom/CMakeLists.txt
-+++ b/third_party/aom/CMakeLists.txt
-@@ -56,6 +56,10 @@ option(BUILD_SHARED_LIBS "CMake should generate a shared library build." OFF)
-
- project(AOM C CXX)
-
-+set(CMAKE_C_FLAGS "-msimd128 -msse2 -msse3 -msse4.1 -msse4.2 ${CMAKE_C_FLAGS}")
-+set(CMAKE_CXX_FLAGS "-msimd128 -msse2 -msse3 -msse4.1 -msse4.2 ${CMAKE_CXX_FLAGS}")
-+set(CMAKE_VERBOSE_MAKEFILE on)
-+
- set(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
- set(AOM_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
- set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include"
-@@ -347,7 +351,7 @@ if(CONFIG_AV1_DECODER AND ENABLE_EXAMPLES)
- em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js")
- # Force generation of Wasm instead of asm.js
- append_link_flag_to_target("inspect" "-s WASM=1")
-- append_compiler_flag("-s WASM=1")
-+ append_compiler_flag("-O3 -s WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0")
- endif()
- endif()
-
-diff --git a/third_party/aom/aom/src/aom_codec.c b/third_party/aom/aom/src/aom_codec.c
-index dbd6fa5..a8d2a49 100644
---- a/third_party/aom/aom/src/aom_codec.c
-+++ b/third_party/aom/aom/src/aom_codec.c
-@@ -132,6 +132,7 @@ void aom_internal_error(struct aom_internal_error_info *info,
- info->detail[sz - 1] = '\0';
- }
-
-+ printf("##aom internal error: %s\n", info->detail);
- if (info->setjmp) longjmp(info->jmp, info->error_code);
- }
-
-diff --git a/third_party/aom/aom_dsp/grain_table.c b/third_party/aom/aom_dsp/grain_table.c
-index 0d6a73f..4b05833 100644
---- a/third_party/aom/aom_dsp/grain_table.c
-+++ b/third_party/aom/aom_dsp/grain_table.c
-@@ -293,6 +293,9 @@ aom_codec_err_t aom_film_grain_table_read(
- return error_info->error_code;
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- aom_codec_err_t aom_film_grain_table_write(
- const aom_film_grain_table_t *t, const char *filename,
- struct aom_internal_error_info *error_info) {
-@@ -305,7 +308,7 @@ aom_codec_err_t aom_film_grain_table_write(
- return error_info->error_code;
- }
-
-- if (!fwrite(kFileMagic, 8, 1, file)) {
-+ if (!emcc_fwrite(kFileMagic, 8, 1, file)) {
- aom_internal_error(error_info, AOM_CODEC_ERROR,
- "Unable to write file magic");
- fclose(file);
-diff --git a/third_party/aom/aomdec.c b/third_party/aom/aomdec.c
-index 4addee8..f850147 100644
---- a/third_party/aom/aomdec.c
-+++ b/third_party/aom/aomdec.c
-@@ -274,6 +274,9 @@ static void update_image_md5(const aom_image_t *img, const int planes[3],
- }
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- static void write_image_file(const aom_image_t *img, const int *planes,
- const int num_planes, FILE *file) {
- int i, y;
-@@ -287,7 +290,7 @@ static void write_image_file(const aom_image_t *img, const int *planes,
- const int h = aom_img_plane_height(img, plane);
-
- for (y = 0; y < h; ++y) {
-- fwrite(buf, bytes_per_sample, w, file);
-+ emcc_fwrite(buf, bytes_per_sample, w, file);
- buf += stride;
- }
- }
-diff --git a/third_party/aom/aomenc.c b/third_party/aom/aomenc.c
-index 64155b0..3ed5080 100644
---- a/third_party/aom/aomenc.c
-+++ b/third_party/aom/aomenc.c
-@@ -59,9 +59,12 @@ static size_t wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
- }
- #define fread wrap_fread
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- static size_t wrap_fwrite(const void *ptr, size_t size, size_t nmemb,
- FILE *stream) {
-- return fwrite(ptr, size, nmemb, stream);
-+ return emcc_fwrite(ptr, size, nmemb, stream);
- }
- #define fwrite wrap_fwrite
-
-diff --git a/third_party/aom/aomstats.c b/third_party/aom/aomstats.c
-index 0cfeea2..6833776 100644
---- a/third_party/aom/aomstats.c
-+++ b/third_party/aom/aomstats.c
-@@ -80,9 +80,12 @@ void stats_close(stats_io_t *stats, int last_pass) {
- }
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- void stats_write(stats_io_t *stats, const void *pkt, size_t len) {
- if (stats->file) {
-- (void)fwrite(pkt, 1, len, stats->file);
-+ (void)emcc_fwrite(pkt, 1, len, stats->file);
- } else {
- if (stats->buf.sz + len > stats->buf_alloc_sz) {
- size_t new_sz = stats->buf_alloc_sz + 64 * 1024;
-diff --git a/third_party/aom/av1/common/debugmodes.c b/third_party/aom/av1/common/debugmodes.c
-index 868f341..c44258c 100644
---- a/third_party/aom/av1/common/debugmodes.c
-+++ b/third_party/aom/av1/common/debugmodes.c
-@@ -89,10 +89,13 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
- fclose(mvs);
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- void av1_print_uncompressed_frame_header(const uint8_t *data, int size,
- const char *filename) {
- FILE *hdrFile = fopen(filename, "w");
-- fwrite(data, size, sizeof(uint8_t), hdrFile);
-+ emcc_fwrite(data, size, sizeof(uint8_t), hdrFile);
- fclose(hdrFile);
- }
-
-diff --git a/third_party/aom/av1/encoder/encoder.c b/third_party/aom/av1/encoder/encoder.c
-index a557380..d709d26 100644
---- a/third_party/aom/av1/encoder/encoder.c
-+++ b/third_party/aom/av1/encoder/encoder.c
-@@ -2799,6 +2799,9 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
- snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
- #endif // CONFIG_INTERNAL_STATS
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- void av1_remove_compressor(AV1_COMP *cpi) {
- AV1_COMMON *cm;
- unsigned int i;
-@@ -2814,7 +2817,7 @@ void av1_remove_compressor(AV1_COMP *cpi) {
- if (cpi->oxcf.pass != 1) {
- fprintf(stderr, "Writing counts.stt\n");
- FILE *f = fopen("counts.stt", "wb");
-- fwrite(&aggregate_fc, sizeof(aggregate_fc), 1, f);
-+ emcc_fwrite(&aggregate_fc, sizeof(aggregate_fc), 1, f);
- fclose(f);
- }
- #endif // CONFIG_ENTROPY_STATS
-@@ -3013,7 +3016,7 @@ void aom_write_yuv_frame_420(YV12_BUFFER_CONFIG *s, FILE *f) {
- int h = s->y_height;
-
- do {
-- fwrite(src, s->y_width, 1, f);
-+ emcc_fwrite(src, s->y_width, 1, f);
- src += s->y_stride;
- } while (--h);
-
-@@ -3021,7 +3024,7 @@ void aom_write_yuv_frame_420(YV12_BUFFER_CONFIG *s, FILE *f) {
- h = s->uv_height;
-
- do {
-- fwrite(src, s->uv_width, 1, f);
-+ emcc_fwrite(src, s->uv_width, 1, f);
- src += s->uv_stride;
- } while (--h);
-
-@@ -3029,7 +3032,7 @@ void aom_write_yuv_frame_420(YV12_BUFFER_CONFIG *s, FILE *f) {
- h = s->uv_height;
-
- do {
-- fwrite(src, s->uv_width, 1, f);
-+ emcc_fwrite(src, s->uv_width, 1, f);
- src += s->uv_stride;
- } while (--h);
- }
-@@ -3121,7 +3124,7 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
- uint16_t *src16 = CONVERT_TO_SHORTPTR(s->y_buffer);
-
- do {
-- fwrite(src16, s->y_width, 2, yuv_rec_file);
-+ emcc_fwrite(src16, s->y_width, 2, yuv_rec_file);
- src16 += s->y_stride;
- } while (--h);
-
-@@ -3129,7 +3132,7 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
- h = s->uv_height;
-
- do {
-- fwrite(src16, s->uv_width, 2, yuv_rec_file);
-+ emcc_fwrite(src16, s->uv_width, 2, yuv_rec_file);
- src16 += s->uv_stride;
- } while (--h);
-
-@@ -3137,7 +3140,7 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
- h = s->uv_height;
-
- do {
-- fwrite(src16, s->uv_width, 2, yuv_rec_file);
-+ emcc_fwrite(src16, s->uv_width, 2, yuv_rec_file);
- src16 += s->uv_stride;
- } while (--h);
-
-@@ -3146,7 +3149,7 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
- }
-
- do {
-- fwrite(src, s->y_width, 1, yuv_rec_file);
-+ emcc_fwrite(src, s->y_width, 1, yuv_rec_file);
- src += s->y_stride;
- } while (--h);
-
-@@ -3154,7 +3157,7 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
- h = s->uv_height;
-
- do {
-- fwrite(src, s->uv_width, 1, yuv_rec_file);
-+ emcc_fwrite(src, s->uv_width, 1, yuv_rec_file);
- src += s->uv_stride;
- } while (--h);
-
-@@ -3162,7 +3165,7 @@ void aom_write_one_yuv_frame(AV1_COMMON *cm, YV12_BUFFER_CONFIG *s) {
- h = s->uv_height;
-
- do {
-- fwrite(src, s->uv_width, 1, yuv_rec_file);
-+ emcc_fwrite(src, s->uv_width, 1, yuv_rec_file);
- src += s->uv_stride;
- } while (--h);
-
-@@ -3241,16 +3244,16 @@ static int dump_one_image(AV1_COMMON *cm,
-
- // --- Y ---
- for (h = 0; h < cm->height; ++h) {
-- fwrite(&ref_buf->y_buffer[h * ref_buf->y_stride], 1, cm->width, f_ref);
-+ emcc_fwrite(&ref_buf->y_buffer[h * ref_buf->y_stride], 1, cm->width, f_ref);
- }
- // --- U ---
- for (h = 0; h < (cm->height >> 1); ++h) {
-- fwrite(&ref_buf->u_buffer[h * ref_buf->uv_stride], 1, (cm->width >> 1),
-+ emcc_fwrite(&ref_buf->u_buffer[h * ref_buf->uv_stride], 1, (cm->width >> 1),
- f_ref);
- }
- // --- V ---
- for (h = 0; h < (cm->height >> 1); ++h) {
-- fwrite(&ref_buf->v_buffer[h * ref_buf->uv_stride], 1, (cm->width >> 1),
-+ emcc_fwrite(&ref_buf->v_buffer[h * ref_buf->uv_stride], 1, (cm->width >> 1),
- f_ref);
- }
-
-@@ -4692,17 +4695,17 @@ static void dump_filtered_recon_frames(AV1_COMP *cpi) {
-
- // --- Y ---
- for (h = 0; h < cm->height; ++h) {
-- fwrite(&recon_buf->y_buffer[h * recon_buf->y_stride], 1, cm->width,
-+ emcc_fwrite(&recon_buf->y_buffer[h * recon_buf->y_stride], 1, cm->width,
- f_recon);
- }
- // --- U ---
- for (h = 0; h < (cm->height >> 1); ++h) {
-- fwrite(&recon_buf->u_buffer[h * recon_buf->uv_stride], 1, (cm->width >> 1),
-+ emcc_fwrite(&recon_buf->u_buffer[h * recon_buf->uv_stride], 1, (cm->width >> 1),
- f_recon);
- }
- // --- V ---
- for (h = 0; h < (cm->height >> 1); ++h) {
-- fwrite(&recon_buf->v_buffer[h * recon_buf->uv_stride], 1, (cm->width >> 1),
-+ emcc_fwrite(&recon_buf->v_buffer[h * recon_buf->uv_stride], 1, (cm->width >> 1),
- f_recon);
- }
-
-diff --git a/third_party/aom/av1/encoder/firstpass.c b/third_party/aom/av1/encoder/firstpass.c
-index bb73fde..b963043 100644
---- a/third_party/aom/av1/encoder/firstpass.c
-+++ b/third_party/aom/av1/encoder/firstpass.c
-@@ -476,6 +476,9 @@ static double raw_motion_error_stdev(int *raw_motion_err_list,
- return raw_err_stdev;
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- #define UL_INTRA_THRESH 50
- #define INVALID_ROW -1
- void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
-@@ -1077,7 +1080,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
- else
- recon_file = fopen(filename, "ab");
-
-- (void)fwrite(lst_yv12->buffer_alloc, lst_yv12->frame_size, 1, recon_file);
-+ (void)emcc_fwrite(lst_yv12->buffer_alloc, lst_yv12->frame_size, 1, recon_file);
- fclose(recon_file);
- }
-
-diff --git a/third_party/aom/build/cmake/aom_configure.cmake b/third_party/aom/build/cmake/aom_configure.cmake
-index 9220a32..fb8bf9f 100644
---- a/third_party/aom/build/cmake/aom_configure.cmake
-+++ b/third_party/aom/build/cmake/aom_configure.cmake
-@@ -260,7 +260,7 @@ if(MSVC)
- add_compiler_flag_if_supported("/WX")
- endif()
- else()
-- require_c_flag("-std=c99" YES)
-+ #require_c_flag("-std=c99" YES)
- add_compiler_flag_if_supported("-Wall")
- add_compiler_flag_if_supported("-Wdisabled-optimization")
- add_compiler_flag_if_supported("-Wextra")
-diff --git a/third_party/aom/examples/resize_util.c b/third_party/aom/examples/resize_util.c
-index 5485691..e60ed86 100644
---- a/third_party/aom/examples/resize_util.c
-+++ b/third_party/aom/examples/resize_util.c
-@@ -45,6 +45,9 @@ static int parse_dim(char *v, int *width, int *height) {
- return 1;
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- int main(int argc, char *argv[]) {
- char *fin, *fout;
- FILE *fpin, *fpout;
-@@ -111,7 +114,7 @@ int main(int argc, char *argv[]) {
- av1_resize_frame420(inbuf, width, inbuf_u, inbuf_v, width / 2, height,
- width, outbuf, target_width, outbuf_u, outbuf_v,
- target_width / 2, target_height, target_width);
-- fwrite(outbuf, target_width * target_height * 3 / 2, 1, fpout);
-+ emcc_fwrite(outbuf, target_width * target_height * 3 / 2, 1, fpout);
- f++;
- }
- printf("%d frames processed\n", f);
-diff --git a/third_party/aom/examples/scalable_encoder.c b/third_party/aom/examples/scalable_encoder.c
-index 10d647e..fcf31e1 100644
---- a/third_party/aom/examples/scalable_encoder.c
-+++ b/third_party/aom/examples/scalable_encoder.c
-@@ -91,6 +91,9 @@ void usage_exit(void) {
- exit(EXIT_FAILURE);
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- static int encode_frame(aom_codec_ctx_t *codec, aom_image_t *img,
- int frame_index, int flags, FILE *outfile) {
- int got_pkts = 0;
-@@ -105,7 +108,7 @@ static int encode_frame(aom_codec_ctx_t *codec, aom_image_t *img,
-
- if (pkt->kind == AOM_CODEC_CX_FRAME_PKT) {
- const int keyframe = (pkt->data.frame.flags & AOM_FRAME_IS_KEY) != 0;
-- if (fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile) !=
-+ if (emcc_fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile) !=
- pkt->data.frame.sz) {
- die_codec(codec, "Failed to write compressed frame");
- }
-diff --git a/third_party/aom/ivfenc.c b/third_party/aom/ivfenc.c
-index 80f4d14..d0e4e34 100644
---- a/third_party/aom/ivfenc.c
-+++ b/third_party/aom/ivfenc.c
-@@ -14,6 +14,9 @@
- #include "aom/aom_encoder.h"
- #include "aom_ports/mem_ops.h"
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- void ivf_write_file_header(FILE *outfile, const struct aom_codec_enc_cfg *cfg,
- unsigned int fourcc, int frame_cnt) {
- char header[32];
-@@ -32,7 +35,7 @@ void ivf_write_file_header(FILE *outfile, const struct aom_codec_enc_cfg *cfg,
- mem_put_le32(header + 24, frame_cnt); // length
- mem_put_le32(header + 28, 0); // unused
-
-- fwrite(header, 1, 32, outfile);
-+ emcc_fwrite(header, 1, 32, outfile);
- }
-
- void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
-@@ -41,12 +44,12 @@ void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
- mem_put_le32(header, (int)frame_size);
- mem_put_le32(header + 4, (int)(pts & 0xFFFFFFFF));
- mem_put_le32(header + 8, (int)(pts >> 32));
-- fwrite(header, 1, 12, outfile);
-+ emcc_fwrite(header, 1, 12, outfile);
- }
-
- void ivf_write_frame_size(FILE *outfile, size_t frame_size) {
- char header[4];
-
- mem_put_le32(header, (int)frame_size);
-- fwrite(header, 1, 4, outfile);
-+ emcc_fwrite(header, 1, 4, outfile);
- }
-diff --git a/third_party/aom/test/decode_perf_test.cc b/third_party/aom/test/decode_perf_test.cc
-index 3c93e7d..2d364ae 100644
---- a/third_party/aom/test/decode_perf_test.cc
-+++ b/third_party/aom/test/decode_perf_test.cc
-@@ -24,6 +24,11 @@
-
- using ::testing::make_tuple;
-
-+extern "C" {
-+ size_t
-+ emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+}
-+
- namespace {
-
- #define VIDEO_NAME 0
-@@ -153,7 +158,7 @@ class AV1NewEncodeDecodePerfTest
-
- // Write frame header and data.
- ivf_write_frame_header(outfile_, out_frames_, pkt->data.frame.sz);
-- ASSERT_EQ(fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_),
-+ ASSERT_EQ(emcc_fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_),
- pkt->data.frame.sz);
- }
-
-diff --git a/third_party/aom/test/film_grain_table_test.cc b/third_party/aom/test/film_grain_table_test.cc
-index 0688146..dbb8e6b 100644
---- a/third_party/aom/test/film_grain_table_test.cc
-+++ b/third_party/aom/test/film_grain_table_test.cc
-@@ -5,6 +5,11 @@
- #include "av1/encoder/grain_test_vectors.h"
- #include "test/video_source.h"
-
-+extern "C" {
-+ size_t
-+ emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+}
-+
- void grain_equal(const aom_film_grain_t *expected,
- const aom_film_grain_t *actual) {
- EXPECT_EQ(expected->apply_grain, actual->apply_grain);
-@@ -168,7 +173,7 @@ TEST_F(FilmGrainTableIOTest, ReadTruncatedFile) {
-
- std::string grain_file;
- FILE *file = libaom_test::GetTempOutFile(&grain_file);
-- fwrite("deadbeef", 8, 1, file);
-+ emcc_fwrite("deadbeef", 8, 1, file);
- fclose(file);
- ASSERT_EQ(AOM_CODEC_ERROR,
- aom_film_grain_table_read(&table, grain_file.c_str(), &error_));
-diff --git a/third_party/aom/test/resize_test.cc b/third_party/aom/test/resize_test.cc
-index e1c4e9f..9c2bce8 100644
---- a/third_party/aom/test/resize_test.cc
-+++ b/third_party/aom/test/resize_test.cc
-@@ -22,6 +22,11 @@
- // Enable(1) or Disable(0) writing of the compressed bitstream.
- #define WRITE_COMPRESSED_STREAM 0
-
-+extern "C" {
-+ size_t
-+ emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+}
-+
- namespace {
-
- #if WRITE_COMPRESSED_STREAM
-@@ -55,13 +60,13 @@ static void write_ivf_file_header(const aom_codec_enc_cfg_t *const cfg,
- mem_put_le32(header + 24, frame_cnt); /* length */
- mem_put_le32(header + 28, 0); /* unused */
-
-- (void)fwrite(header, 1, 32, outfile);
-+ (void)emcc_fwrite(header, 1, 32, outfile);
- }
-
- static void write_ivf_frame_size(FILE *const outfile, const size_t size) {
- char header[4];
- mem_put_le32(header, static_cast<unsigned int>(size));
-- (void)fwrite(header, 1, 4, outfile);
-+ (void)emcc_fwrite(header, 1, 4, outfile);
- }
-
- static void write_ivf_frame_header(const aom_codec_cx_pkt_t *const pkt,
-@@ -76,7 +81,7 @@ static void write_ivf_frame_header(const aom_codec_cx_pkt_t *const pkt,
- mem_put_le32(header + 4, pts & 0xFFFFFFFF);
- mem_put_le32(header + 8, pts >> 32);
-
-- (void)fwrite(header, 1, 12, outfile);
-+ (void)emcc_fwrite(header, 1, 12, outfile);
- }
- #endif // WRITE_COMPRESSED_STREAM
-
-@@ -309,7 +314,7 @@ class ResizeInternalTestLarge : public ResizeTest {
-
- // Write frame header and data.
- write_ivf_frame_header(pkt, outfile_);
-- (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);
-+ (void)emcc_fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);
- }
- #endif
-
-@@ -608,7 +613,7 @@ class ResizeCspTest : public ResizeTest {
-
- // Write frame header and data.
- write_ivf_frame_header(pkt, outfile_);
-- (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);
-+ (void)emcc_fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);
- }
- #endif
-
-diff --git a/third_party/aom/test/y4m_test.cc b/third_party/aom/test/y4m_test.cc
-index ad901d9..f24093f 100644
---- a/third_party/aom/test/y4m_test.cc
-+++ b/third_party/aom/test/y4m_test.cc
-@@ -19,6 +19,11 @@
- #include "test/util.h"
- #include "test/y4m_video_source.h"
-
-+extern "C" {
-+ size_t
-+ emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+}
-+
- namespace {
-
- using std::string;
-@@ -68,7 +73,7 @@ static void write_image_file(const aom_image_t *img, FILE *file) {
- (plane ? (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift
- : img->d_w);
- for (y = 0; y < h; ++y) {
-- fwrite(buf, bytes_per_sample, w, file);
-+ emcc_fwrite(buf, bytes_per_sample, w, file);
- buf += stride;
- }
- }
-diff --git a/third_party/aom/third_party/googletest/src/googletest/src/gtest.cc b/third_party/aom/third_party/googletest/src/googletest/src/gtest.cc
-index 5a8932c..ac2c435 100644
---- a/third_party/aom/third_party/googletest/src/googletest/src/gtest.cc
-+++ b/third_party/aom/third_party/googletest/src/googletest/src/gtest.cc
-@@ -146,6 +146,11 @@
- # define vsnprintf _vsnprintf
- #endif // GTEST_OS_WINDOWS
-
-+extern "C" {
-+ size_t
-+ emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+}
-+
- namespace testing {
-
- using internal::CountIf;
-@@ -3867,7 +3872,7 @@ class ScopedPrematureExitFile {
- // errors are ignored as there's nothing better we can do and we
- // don't want to fail the test because of this.
- FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
-- fwrite("0", 1, 1, pfile);
-+ emcc_fwrite("0", 1, 1, pfile);
- fclose(pfile);
- }
- }
-diff --git a/third_party/aom/third_party/libwebm/mkvmuxer/mkvwriter.cc b/third_party/aom/third_party/libwebm/mkvmuxer/mkvwriter.cc
-index 84655d8..0004093 100644
---- a/third_party/aom/third_party/libwebm/mkvmuxer/mkvwriter.cc
-+++ b/third_party/aom/third_party/libwebm/mkvmuxer/mkvwriter.cc
-@@ -14,6 +14,11 @@
- #include <share.h> // for _SH_DENYWR
- #endif
-
-+extern "C" {
-+ size_t
-+ emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+}
-+
- namespace mkvmuxer {
-
- MkvWriter::MkvWriter() : file_(NULL), writer_owns_file_(true) {}
-@@ -32,7 +37,7 @@ int32 MkvWriter::Write(const void* buffer, uint32 length) {
- if (buffer == NULL)
- return -1;
-
-- const size_t bytes_written = fwrite(buffer, 1, length, file_);
-+ const size_t bytes_written = emcc_fwrite(buffer, 1, length, file_);
-
- return (bytes_written == length) ? 0 : -1;
- }
-diff --git a/third_party/aom/tools_common.c b/third_party/aom/tools_common.c
-index 7abc20c..fbc30bc 100644
---- a/third_party/aom/tools_common.c
-+++ b/third_party/aom/tools_common.c
-@@ -185,6 +185,9 @@ const AvxInterface *get_aom_decoder_by_fourcc(uint32_t fourcc) {
- }
- #endif // CONFIG_AV1_DECODER
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- void aom_img_write(const aom_image_t *img, FILE *file) {
- int plane;
-
-@@ -197,7 +200,7 @@ void aom_img_write(const aom_image_t *img, FILE *file) {
- int y;
-
- for (y = 0; y < h; ++y) {
-- fwrite(buf, 1, w, file);
-+ emcc_fwrite(buf, 1, w, file);
- buf += stride;
- }
- }
-diff --git a/third_party/aom/video_writer.c b/third_party/aom/video_writer.c
-index 4e072c7..6b1ca54 100644
---- a/third_party/aom/video_writer.c
-+++ b/third_party/aom/video_writer.c
-@@ -66,10 +66,13 @@ void aom_video_writer_close(AvxVideoWriter *writer) {
- }
- }
-
-+size_t
-+emcc_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-+
- int aom_video_writer_write_frame(AvxVideoWriter *writer, const uint8_t *buffer,
- size_t size, int64_t pts) {
- ivf_write_frame_header(writer->file, pts, size);
-- if (fwrite(buffer, 1, size, writer->file) != size) return 0;
-+ if (emcc_fwrite(buffer, 1, size, writer->file) != size) return 0;
-
- ++writer->frame_count;
-