Skip to content

Commit

Permalink
Move ckb_cell_fs.c/h to quickjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Sep 18, 2024
1 parent 8874a23 commit 8c4ca85
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ $(OBJDIR)/%.o: quickjs/%.c
@echo build $<
@$(CC) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/%.o: include/%.c
@echo build $<
@$(CC) $(CFLAGS) -c -o $@ $<

test:
make -f tests/examples/Makefile
make -f tests/basic/Makefile
Expand All @@ -86,6 +82,20 @@ clean:
cd tests/ckb_js_tests && make clean
make -C deps/compiler-rt-builtins-riscv clean

STYLE := "{BasedOnStyle: Google, TabWidth: 4, IndentWidth: 4, UseTab: Never, SortIncludes: false, ColumnLimit: 120}"

fmt:
clang-format-18 -i -style=$(STYLE) \
quickjs/ckb_cell_fs.c \
quickjs/ckb_cell_fs.h \
quickjs/ckb_module.c \
quickjs/ckb_module.h \
quickjs/mocked.c \
quickjs/mocked.h \
quickjs/qjs.c \
quickjs/std_module.c \
quickjs/std_module.h

install:
wget 'https://github.com/nervosnetwork/ckb-standalone-debugger/releases/download/v0.118.0-rc2/ckb-debugger-linux-x64.tar.gz'
tar zxvf ckb-debugger-linux-x64.tar.gz
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions quickjs/ckb_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static JSValue syscall_spawn_cell(JSContext *ctx, JSValueConst this_value, int a
uint32_t offset = 0;
uint32_t length = 0;
uint32_t spgs_argc = 0;
const char* spgs_argv[32] = {};
const char *spgs_argv[32] = {};
uint64_t spgs_pid = 0;
uint64_t spgs_fds[32] = {0};

Expand Down Expand Up @@ -478,7 +478,7 @@ static JSValue syscall_inherited_fds(JSContext *ctx, JSValueConst this_value, in
static JSValue syscall_read(JSContext *ctx, JSValueConst this_value, int argc, JSValueConst *argv) {
int err = 0;
uint64_t fd = 0;
void* buffer = {};
void *buffer = {};
size_t length = 0;
uint32_t u32 = 0;
err = JS_ToUint32(ctx, &u32, argv[0]);
Expand Down Expand Up @@ -628,7 +628,8 @@ int js_init_module_ckb(JSContext *ctx) {
JS_SetPropertyStr(ctx, ckb, "close", JS_NewCFunction(ctx, syscall_close, "close", 1));
JS_SetPropertyStr(ctx, ckb, "wait", JS_NewCFunction(ctx, syscall_wait, "wait", 1));
JS_SetPropertyStr(ctx, ckb, "process_id", JS_NewCFunction(ctx, syscall_process_id, "process_id", 0));
JS_SetPropertyStr(ctx, ckb, "load_block_extension", JS_NewCFunction(ctx, syscall_load_block_extension, "load_block_extension", 3));
JS_SetPropertyStr(ctx, ckb, "load_block_extension",
JS_NewCFunction(ctx, syscall_load_block_extension, "load_block_extension", 3));
JS_SetPropertyStr(ctx, ckb, "mount", JS_NewCFunction(ctx, mount, "mount", 2));
JS_SetPropertyStr(ctx, ckb, "SOURCE_INPUT", JS_NewInt64(ctx, CKB_SOURCE_INPUT));
JS_SetPropertyStr(ctx, ckb, "SOURCE_OUTPUT", JS_NewInt64(ctx, CKB_SOURCE_OUTPUT));
Expand Down
8 changes: 2 additions & 6 deletions quickjs/mocked.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

int __wrap_fesetround(int _round) { return 0; }

int __wrap_gettimeofday(struct timeval *restrict tv, struct timezone *restrict tz) {
return 0;
}
int __wrap_gettimeofday(struct timeval *restrict tv, struct timezone *restrict tz) { return 0; }

struct tm *__wrap_localtime_r(const time_t *a, struct tm *b) {
return 0;
}
struct tm *__wrap_localtime_r(const time_t *a, struct tm *b) { return 0; }

0 comments on commit 8c4ca85

Please sign in to comment.