M .build.yml => .build.yml +0 -1
@@ 21,5 21,4 @@ tasks:
cd $NAME
set +x
../umbox_portable/umbox upload `cat ../.secret` box.tar
- ../umbox_portable/umbox upload `cat ../.secret` box.json
set -x
M Makefile => Makefile +3 -3
@@ 11,8 11,8 @@ CFLAGS= \
-I. \
-Imicrotar/src/ \
-fPIC \
- -g
-LDFLAGS=umbox/umka/linux/libumka_static.a
+ -O3
+LDFLAGS=
.PHONY: all
all: build
@@ 23,7 23,7 @@ all: build
%_windows.umi: %.c Makefile
@echo CC $@
- @$(CROSS_CC) -shared $(CFLAGS) -o $@ $< microtar/src/microtar.c -Lumbox/umka/windows -lumka
+ @$(CROSS_CC) -shared $(CFLAGS) -o $@ $< microtar/src/microtar.c
.PHONY: build
build: $(NAME)_windows.umi $(NAME)_linux.umi
A compile_commands.json => compile_commands.json +44 -0
@@ 0,0 1,44 @@
+[
+ {
+ "arguments": [
+ "/usr/bin/x86_64-w64-mingw32-gcc",
+ "-c",
+ "-Wall",
+ "-Wno-unused-label",
+ "-Wno-pointer-to-int-cast",
+ "-Wno-unused-result",
+ "-Iumbox/umka/",
+ "-I.",
+ "-Imicrotar/src/",
+ "-fPIC",
+ "-g",
+ "-o",
+ "tar_windows.umi",
+ "tar.c"
+ ],
+ "directory": "/home/marek/dev/umlibs/tar",
+ "file": "/home/marek/dev/umlibs/tar/tar.c",
+ "output": "/home/marek/dev/umlibs/tar/tar_windows.umi"
+ },
+ {
+ "arguments": [
+ "/usr/bin/x86_64-w64-mingw32-gcc",
+ "-c",
+ "-Wall",
+ "-Wno-unused-label",
+ "-Wno-pointer-to-int-cast",
+ "-Wno-unused-result",
+ "-Iumbox/umka/",
+ "-I.",
+ "-Imicrotar/src/",
+ "-fPIC",
+ "-g",
+ "-o",
+ "tar_windows.umi",
+ "microtar/src/microtar.c"
+ ],
+ "directory": "/home/marek/dev/umlibs/tar",
+ "file": "/home/marek/dev/umlibs/tar/microtar/src/microtar.c",
+ "output": "/home/marek/dev/umlibs/tar/tar_windows.umi"
+ }
+]
M tar.c => tar.c +14 -9
@@ 28,8 28,9 @@ umc__tar_strerror(UmkaStackSlot *p, UmkaStackSlot *r)
{
int err = p[0].intVal;
void *umka = r->ptrVal;
+ UmkaAPI *api = umkaGetAPI(umka);
- r->ptrVal = umkaMakeStr(umka, mtar_strerror(err));
+ r->ptrVal = api->umkaMakeStr(umka, mtar_strerror(err));
}
// fn umc__tar_open(path: str, mode: str, out: ^^struct{}): int
@@ 40,8 41,9 @@ umc__tar_open(UmkaStackSlot *p, UmkaStackSlot *r)
char *mode = (char *)p[1].ptrVal;
mtar_t **out = (mtar_t **)p[0].ptrVal;
void *umka = r->ptrVal;
+ UmkaAPI *api = umkaGetAPI(umka);
- *out = umkaAllocData(umka, sizeof(mtar_t), NULL);
+ *out = api->umkaAllocData(umka, sizeof(mtar_t), NULL);
r->intVal = mtar_open(*out, path, mode);
if (r->intVal != MTAR_ESUCCESS) {
@@ 84,9 86,10 @@ umc__tar_open_bytes(UmkaStackSlot *p, UmkaStackSlot *r)
UmkaDynArray(uint8_t) *bytes_in = p[1].ptrVal;
mtar_t **out = (mtar_t **)p[0].ptrVal;
void *umka = r->ptrVal;
+ UmkaAPI *api = umkaGetAPI(umka);
- *out = umkaAllocData(umka, sizeof(mtar_t), NULL);
- size_t bytes_len = umkaGetDynArrayLen(bytes_in);
+ *out = api->umkaAllocData(umka, sizeof(mtar_t), NULL);
+ size_t bytes_len = api->umkaGetDynArrayLen(bytes_in);
uint8_t *bytes = malloc(bytes_len);
memcpy(bytes, bytes_in->data, bytes_len);
@@ 110,6 113,7 @@ umc__tar_get_files(UmkaStackSlot *p, UmkaStackSlot *r)
UmkaDynArray(File) *out = p[1].ptrVal;
void *fileArrType = p[0].ptrVal;
void *umka = r->ptrVal;
+ UmkaAPI *api = umkaGetAPI(umka);
r->intVal = 0;
int ret = mtar_seek(tar, 0);
@@ 125,7 129,7 @@ umc__tar_get_files(UmkaStackSlot *p, UmkaStackSlot *r)
mtar_next(tar);
}
- umkaMakeDynArray(umka, out, fileArrType, count);
+ api->umkaMakeDynArray(umka, out, fileArrType, count);
mtar_seek(tar, 0);
for (int i = 0; i < count; ++i) {
@@ 136,8 140,8 @@ umc__tar_get_files(UmkaStackSlot *p, UmkaStackSlot *r)
.size = h.size,
.mtime = h.mtime,
.type = h.type,
- .name = umkaMakeStr(umka, h.name),
- .linkname = umkaMakeStr(umka, h.linkname),
+ .name = api->umkaMakeStr(umka, h.name),
+ .linkname = api->umkaMakeStr(umka, h.linkname),
};
mtar_next(tar);
}
@@ 152,6 156,7 @@ umc__tar_read(UmkaStackSlot *p, UmkaStackSlot *r)
UmkaDynArray(uint8_t) *out = p[1].ptrVal;
void *byteArrType = p[0].ptrVal;
void *umka = r->ptrVal;
+ UmkaAPI *api = umkaGetAPI(umka);
r->intVal = 0;
mtar_header_t h;
@@ 161,7 166,7 @@ umc__tar_read(UmkaStackSlot *p, UmkaStackSlot *r)
return;
}
- umkaMakeDynArray(umka, out, byteArrType, h.size);
+ api->umkaMakeDynArray(umka, out, byteArrType, h.size);
ret = mtar_read_data(tar, out->data, h.size);
if (ret) {
@@ 229,4 234,4 @@ umc__tar_finalize(UmkaStackSlot *p, UmkaStackSlot *r)
{
mtar_t *tar = p[0].ptrVal;
r->intVal = mtar_finalize(tar);
-}>
\ No newline at end of file
+}
M tar.um => tar.um +3 -3
@@ 186,11 186,11 @@ fn main() {
printf(" %s\n", files[i].name)
}
- printf("Reading umbox.json:\n")
+ printf("Reading box.json:\n")
var umboxJson: []uint8
- umboxJson, err = tar.read("umbox.json")
+ umboxJson, err = tar.read("box.json")
if err != 0 {
- printf("Error reading umbox.json: %s\n", strerror(err))
+ printf("Error reading box.json: %s\n", strerror(err))
return
}
printf("%s\n", str([]char(umboxJson)))