aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-06-12 14:52:48 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-06-12 14:52:48 +0200
commita47dddea7590920c417ecc66a4fbf7e18272b720 (patch)
treee691bb4908fba342c2e369d1eb2e5b03f91df303 /src
parent4f9a2c7a2d8464b04cc08075a7762c6d457090df (diff)
wip a mess, but it buildsHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/section/code.c75
-rw-r--r--src/section/type.c3
-rw-r--r--src/start.c2
3 files changed, 49 insertions, 31 deletions
diff --git a/src/section/code.c b/src/section/code.c
index 3d62143..7062359 100644
--- a/src/section/code.c
+++ b/src/section/code.c
@@ -20,6 +20,11 @@
#include <stdint.h>
#include <string.h>
+static int run(FILE *const f, const varuint32 idx, struct nw_interp *const in)
+{
+ return -1;
+}
+
static int check_body(FILE *const f, const unsigned long n)
{
unsigned long rem = n;
@@ -148,6 +153,7 @@ static int check_local_group(FILE *const f, struct nw_interp *const i)
return 0;
}
+#if 0
static int run(FILE *const f, struct nw_interp *const in)
{
varuint32 local_count;
@@ -167,6 +173,7 @@ static int run(FILE *const f, struct nw_interp *const in)
return 0;
}
+#endif
static int push_frame(struct nw_interp *const i,
const struct nw_frame *const src)
@@ -202,7 +209,7 @@ static int check_function_body(FILE *const f, long *const out)
LOG("%s: ftell(3) start: %s\n", __func__, strerror(errno));
return -1;
}
- else if (run(f, NULL))
+ else if (run(f, 0, NULL))
{
LOG("%s: check_local_groups failed\n", __func__);
return -1;
@@ -233,35 +240,6 @@ static int check_function_body(FILE *const f, long *const out)
return 0;
}
-static int run(FILE *const f, const varuint32 idx, struct nw_interp *const in)
-{
- varuint32 count;
-
- if (varuint32_read(f, &count))
- {
- LOG("%s: varuint32_read failed\n", __func__);
- return -1;
- }
-
- for (varuint32 i = 0; i < count; i++)
- {
- long start;
-
- if (check_function_body(f, &start))
- {
- LOG("%s: check_function_body failed\n", __func__);
- return -1;
- }
- else if (out && i == idx)
- {
- out->start = start;
- return 0;
- }
- }
-
- return 0;
-}
-
int section_code_check(const struct section *const s, struct nw_mod *const m,
const unsigned long len)
{
@@ -280,7 +258,7 @@ int section_code_check(const struct section *const s, struct nw_mod *const m,
LOG("%s: ftell(3): %s\n", __func__, strerror(errno));
return -1;
}
- else if (run(f, NULL))
+ else if (run(f, 0, NULL))
{
LOG("%s: run failed\n", __func__);
return -1;
@@ -307,6 +285,37 @@ int section_code_check(const struct section *const s, struct nw_mod *const m,
return 0;
}
+#if 0
+static int run(FILE *const f, const varuint32 idx, struct nw_interp *const in)
+{
+ varuint32 count;
+
+ if (varuint32_read(f, &count))
+ {
+ LOG("%s: varuint32_read failed\n", __func__);
+ return -1;
+ }
+
+ for (varuint32 i = 0; i < count; i++)
+ {
+ long start;
+
+ if (check_function_body(f, &start))
+ {
+ LOG("%s: check_function_body failed\n", __func__);
+ return -1;
+ }
+ else if (out && i == idx)
+ {
+ out->start = start;
+ return 0;
+ }
+ }
+
+ return 0;
+}
+#endif
+
int section_code(const struct section *const s, const struct nw_mod *const m,
const varuint32 idx, struct section_code *const out)
{
@@ -328,5 +337,9 @@ int section_code(const struct section *const s, const struct nw_mod *const m,
int section_code_push(FILE *const f, struct nw_interp *const i)
{
+#if 0
return run(f, i);
+#else
+ return run(f, 0, i);
+#endif
}
diff --git a/src/section/type.c b/src/section/type.c
index f7bc712..4250a21 100644
--- a/src/section/type.c
+++ b/src/section/type.c
@@ -163,6 +163,7 @@ int section_type_check(const struct section *const s, struct nw_mod *const m,
int section_type_push(FILE *const f, const struct nw_mod *const m,
const varuint32 idx, struct retval *const out)
{
+#if 0
const long offset = m->sections.type;
if (offset <= 0)
@@ -177,4 +178,6 @@ int section_type_push(FILE *const f, const struct nw_mod *const m,
}
return run(f, 0, idx, out);
+#endif
+ return -1;
}
diff --git a/src/start.c b/src/start.c
index e8bc730..a317884 100644
--- a/src/start.c
+++ b/src/start.c
@@ -66,11 +66,13 @@ int nw_start(const struct nw_inst_cfg *const icfg, struct nw_inst *const i)
LOG("%s: section_code_push failed\n", __func__);
goto end;
}
+#if 0
else if (interp_push(&i->interp, &fr))
{
LOG("%s: interp_push failed\n", __func__);
goto end;
}
+#endif
ret = 0;