From 33fffebaa8873e768e6cd6a9d315b45a7618c30d Mon Sep 17 00:00:00 2001 From: ccleavinger <96743974+ccleavinger@users.noreply.github.com> Date: Sun, 24 Nov 2024 07:02:12 -0600 Subject: [PATCH] Fixed CLFuncFn and broken macros in cyber.h (#99) * Update cyber.h added extern "C" if using C++ compiler and prevented redefinitions from occurring. * Updated type macros and CLFuncFn * resolved diffs for updating type macros and CLFuncFn parameters * Hopefully fix build. * Hopefully fix build. --------- Co-authored-by: fubark --- .github/workflows/latest-build.yml | 10 +++++----- .github/workflows/pr-build.yml | 10 +++++----- src/include/cyber.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/latest-build.yml b/.github/workflows/latest-build.yml index a9083e2de..f45e28d2c 100644 --- a/.github/workflows/latest-build.yml +++ b/.github/workflows/latest-build.yml @@ -127,7 +127,7 @@ jobs: - name: Install zig. if: env.BUILD_HOST == 'ubuntu-22.04' run: | - wget -c https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin - name: Install wasm3. if: env.BUILD_HOST == 'ubuntu-22.04' && (env.BUILD_TARGET == 'wasm32-freestanding' || env.BUILD_TARGET == 'wasm32-wasi') @@ -142,19 +142,19 @@ jobs: - name: Install zig. if: env.BUILD_HOST == 'macos-12' run: | - wget -c https://ziglang.org/builds/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path - name: Install zig. if: env.BUILD_HOST == 'macos-14' run: | - wget -c https://ziglang.org/builds/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path - name: Install zig. if: env.BUILD_HOST == 'windows-2022' run: | - Invoke-WebRequest -Uri 'https://ziglang.org/builds/zig-windows-x86_64-${{ env.ZIG_VERSION }}.zip' -OutFile 'C:\zig.zip' + Invoke-WebRequest -Uri 'https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-windows-x86_64-${{ env.ZIG_VERSION }}.zip' -OutFile 'C:\zig.zip' cd C:\ 7z x zig.zip Add-Content $env:GITHUB_PATH 'C:\zig-windows-x86_64-${{ env.ZIG_VERSION }}\' @@ -332,7 +332,7 @@ jobs: - name: Install zig. run: | - wget -c https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin - name: Build md4c. run: | diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 3ff6e1256..031be396e 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -108,7 +108,7 @@ jobs: - name: Install zig. if: env.BUILD_HOST == 'ubuntu-22.04' run: | - wget -c https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin - name: Install wasm3. if: env.BUILD_HOST == 'ubuntu-22.04' && (env.BUILD_TARGET == 'wasm32-freestanding' || env.BUILD_TARGET == 'wasm32-wasi') @@ -123,19 +123,19 @@ jobs: - name: Install zig. if: env.BUILD_HOST == 'macos-12' run: | - wget -c https://ziglang.org/builds/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path - name: Install zig. if: env.BUILD_HOST == 'macos-14' run: | - wget -c https://ziglang.org/builds/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path - name: Install zig. if: env.BUILD_HOST == 'windows-2022' run: | - Invoke-WebRequest -Uri 'https://ziglang.org/builds/zig-windows-x86_64-${{ env.ZIG_VERSION }}.zip' -OutFile 'C:\zig.zip' + Invoke-WebRequest -Uri 'https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-windows-x86_64-${{ env.ZIG_VERSION }}.zip' -OutFile 'C:\zig.zip' cd C:\ 7z x zig.zip Add-Content $env:GITHUB_PATH 'C:\zig-windows-x86_64-${{ env.ZIG_VERSION }}\' @@ -172,4 +172,4 @@ jobs: wasm3/build/wasm3 zig-out/bin/trace_test.wasm - name: Build. - run: zig build ${{ env.BUILD_CMD }} ${{ env.ZIG_MODE_FLAG }} ${{ env.ZIG_TARGET_FLAG }} \ No newline at end of file + run: zig build ${{ env.BUILD_CMD }} ${{ env.ZIG_MODE_FLAG }} ${{ env.ZIG_TARGET_FLAG }} diff --git a/src/include/cyber.h b/src/include/cyber.h index e2fc69f01..5ac9f0c50 100644 --- a/src/include/cyber.h +++ b/src/include/cyber.h @@ -101,7 +101,7 @@ typedef struct CLModule { } CLModule; // @host func is binded to this function pointer signature. -typedef CLValue (*CLFuncFn)(CLVM* vm); +typedef CLValue (*CLFuncFn)(CLVM*, const CLValue*, uint8_t); typedef struct CLResolverParams { /// Chunk that invoked the resolver. @@ -263,8 +263,8 @@ typedef struct CLHostType { // #define CL_CORE_TYPE(t) ((CLHostType){ .data = { .core_custom = { .type_id = t, .get_children = NULL, .finalizer = NULL }}, .type = CL_BIND_TYPE_CORE_CUSTOM }) // #define CL_CORE_TYPE_EXT(t, gc, f) ((CLHostType){ .data = { .core_custom = { .type_id = t, .get_children = gc, .finalizer = f }}, .type = CL_BIND_TYPE_CORE_CUSTOM }) // #define CL_CORE_TYPE_DECL(t) ((CLHostType){ .data = { .core_decl = { .type_id = t }}, .type = CL_BIND_TYPE_CORE_DECL }) -#define CL_CUSTOM_TYPE(name, ot, gc, f) ((CLHostTypeEntry){ CL_STR(name), (CLHostType){ .data = { .custom = { .out_type_id = ot, .get_children = gc, .finalizer = f, .pre = false }}, .type = CL_BIND_TYPE_CUSTOM }}) -#define CL_CUSTOM_PRE_TYPE(name, ot, gc, f) ((CLHostTypeEntry){ CL_STR(name), (CLHostType){ .data = { .custom = { .out_type_id = ot, .get_children = gc, .finalizer = f, .pre = true }}, .type = CL_BIND_TYPE_CUSTOM }}) +#define CL_CUSTOM_TYPE(name, ot, gc, f) ((CLHostTypeEntry){ CL_STR(name), (CLHostType){ .data = { .hostobj = { .out_type_id = ot, .pre = false, .get_children = gc, .finalizer = f }}, .type = CL_BIND_TYPE_HOSTOBJ }}) +#define CL_CUSTOM_PRE_TYPE(name, ot, gc, f) ((CLHostTypeEntry){ CL_STR(name), (CLHostType){ .data = { .hostobj = { .out_type_id = ot, .pre = true, .get_children = gc, .finalizer = f }}, .type = CL_BIND_TYPE_HOSTOBJ }}) // A mapping from a matching symbol string to a CLHostType. typedef struct CLHostTypeEntry {