aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2022-06-03 00:50:12 +0200
committerbozo.kopic <bozo@kopic.xyz>2022-06-03 00:50:12 +0200
commit7ae36a21d031c3d71e9015823c61380f88b0595d (patch)
tree8fb619e30b5a7f03f7b7416343ab796f53d74aec
parentc81812414c1b55352aac2c9bdc9b7f4951f2c6ce (diff)
requirements update
-rw-r--r--.gitignore1
-rw-r--r--compile_flags.txt3
-rw-r--r--peru.yaml1
-rw-r--r--requirements.pip.dev.txt2
-rw-r--r--src_c/common.c3
-rw-r--r--src_c/main.c5
-rw-r--r--src_c/pool.c8
-rw-r--r--src_doit/c.py6
-rw-r--r--src_py/opcut/server.py9
9 files changed, 20 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index 5759e43..3fc6df7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/.peru
/build
/cache
+/compile_flags.txt
/deps
/node_modules
/src_py/opcut/bin
diff --git a/compile_flags.txt b/compile_flags.txt
deleted file mode 100644
index ee29114..0000000
--- a/compile_flags.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--Ideps/argparse
--Ideps/hat-util/src_c
--Ideps/jsmn
diff --git a/peru.yaml b/peru.yaml
index 1e733b3..991025f 100644
--- a/peru.yaml
+++ b/peru.yaml
@@ -15,4 +15,5 @@ git module argparse:
git module hat-util:
url: https://github.com/hat-open/hat-util
+ rev: 7f56bb0572aee5a33654118838f999eec04fbd86
pick: src_c
diff --git a/requirements.pip.dev.txt b/requirements.pip.dev.txt
index 6f6d40d..fc82e5a 100644
--- a/requirements.pip.dev.txt
+++ b/requirements.pip.dev.txt
@@ -4,7 +4,7 @@ build >= 0.7.0
doit >= 0.36.0
flake8 >= 4.0.1
furo >= 2022.4.7
-hat-doit ~= 0.8.2
+hat-doit ~= 0.9.0
peru >= 1.3.0
pytest >= 7.1.2
pytest-asyncio >= 0.18.3
diff --git a/src_c/common.c b/src_c/common.c
index 066ff5a..01df99b 100644
--- a/src_c/common.c
+++ b/src_c/common.c
@@ -406,8 +406,7 @@ int opcut_params_init(hat_allocator_t *a, opcut_params_t *params,
if (tokens_len < 0)
return OPCUT_ERROR;
- jsmntok_t *tokens =
- hat_allocator_alloc(a, tokens_len * sizeof(jsmntok_t), NULL);
+ jsmntok_t *tokens = hat_allocator_alloc(a, tokens_len * sizeof(jsmntok_t));
if (!tokens)
return OPCUT_ERROR;
diff --git a/src_c/main.c b/src_c/main.c
index 5532de0..d49db74 100644
--- a/src_c/main.c
+++ b/src_c/main.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <argparse.h>
+#include <hat/libc_allocator.h>
#include "csp.h"
@@ -64,7 +65,7 @@ static int read_stream(hat_allocator_t *a, FILE *stream, opcut_str_t *json) {
while (!(json->len < size)) {
size += 4096;
- char *data = hat_allocator_alloc(a, size, json->data);
+ char *data = hat_allocator_realloc(a, size, json->data);
if (!data)
return OPCUT_ERROR;
@@ -77,7 +78,7 @@ static int read_stream(hat_allocator_t *a, FILE *stream, opcut_str_t *json) {
int main(int argc, char **argv) {
- hat_allocator_t *a = &hat_allocator_libc;
+ hat_allocator_t *a = &hat_libc_allocator;
opcut_pool_t *panel_pool = opcut_pool_create(a, sizeof(opcut_panel_t));
opcut_pool_t *item_pool = opcut_pool_create(a, sizeof(opcut_item_t));
opcut_pool_t *used_pool = opcut_pool_create(a, sizeof(opcut_used_t));
diff --git a/src_c/pool.c b/src_c/pool.c
index 7e2bd02..4bd8250 100644
--- a/src_c/pool.c
+++ b/src_c/pool.c
@@ -25,10 +25,8 @@ static void allocate_block(opcut_pool_t *pool) {
items_per_block = 1;
header_t *block = hat_allocator_alloc(
- pool->a,
- sizeof(header_t) +
- items_per_block * (sizeof(header_t) + pool->item_size),
- NULL);
+ pool->a, sizeof(header_t) +
+ items_per_block * (sizeof(header_t) + pool->item_size));
if (!block)
return;
block->next = pool->blocks;
@@ -44,7 +42,7 @@ static void allocate_block(opcut_pool_t *pool) {
opcut_pool_t *opcut_pool_create(hat_allocator_t *a, size_t item_size) {
- opcut_pool_t *pool = hat_allocator_alloc(a, sizeof(opcut_pool_t), NULL);
+ opcut_pool_t *pool = hat_allocator_alloc(a, sizeof(opcut_pool_t));
if (!pool)
return NULL;
diff --git a/src_doit/c.py b/src_doit/c.py
index fa953ea..69b8cb5 100644
--- a/src_doit/c.py
+++ b/src_doit/c.py
@@ -18,12 +18,12 @@ src_py_dir = Path('src_py')
build_c_dir = build_dir / 'c'
platforms = [common.local_platform]
-if common.local_platform == common.Platform.LINUX:
- platforms.append(common.Platform.WINDOWS)
+if common.local_platform == common.Platform.LINUX_X86_64:
+ platforms.append(common.Platform.WINDOWS_AMD64)
builds = [CBuild(src_paths=[*src_c_dir.rglob('*.c'),
deps_dir / 'argparse/argparse.c',
- deps_dir / 'hat-util/src_c/hat/allocator.c'],
+ deps_dir / 'hat-util/src_c/hat/libc_allocator.c'],
build_dir=build_c_dir / platform.name.lower(),
platform=platform,
cc_flags=['-fPIC', '-O2',
diff --git a/src_py/opcut/server.py b/src_py/opcut/server.py
index 2ae76a2..cd7d048 100644
--- a/src_py/opcut/server.py
+++ b/src_py/opcut/server.py
@@ -1,5 +1,6 @@
from pathlib import Path
import asyncio
+import platform
import subprocess
import sys
@@ -143,10 +144,14 @@ async def _generate_output(output_type, panel, result):
def _get_calculate_cmd(native):
if native and sys.platform == 'linux':
- return [str(common.package_path / 'bin/linux-opcut-calculate')]
+ if platform.machine() == 'x86_64':
+ return [str(common.package_path /
+ 'bin/linux_x86_64-opcut-calculate')]
elif native and sys.platform == 'win32':
- return [str(common.package_path / 'bin/windows-opcut-calculate.exe')]
+ if platform.machine() == 'amd64':
+ return [str(common.package_path /
+ 'bin/windows_amd64-opcut-calculate.exe')]
return [sys.executable, '-m', 'opcut', 'calculate']