Implement datum support and add make for ex-5.52

This commit is contained in:
2021-06-12 10:51:50 -04:00
parent bcabdd3212
commit 15057b52d4
7 changed files with 114 additions and 41 deletions

View File

@@ -1,16 +1,21 @@
#include <stdio.h>
#include "scm_support.h"
#include <stdint.h>
#include <stdlib.h>
#include "datum.h"
int main() {
int val;
int *argl;
void *cont, *entry, *proc, *env;
datum *val;
datum *argl[10];
datum *proc;
void *cont, *entry, *env;
proc = lookup_variable_value("+", env);
val = 1;
argl = list(val);
val = 1;
argl = cons(val, argl);
val = const_int(3);
argl[0] = val;
val = const_int(42);
argl[1] = val;
argl[2] = NULL;
if (primitive_procedure(proc) == 1)
goto primitivebranch3;
compiledbranch2:
@@ -18,7 +23,7 @@ compiledbranch2:
entry = compiled_procedure_entry(proc);
goto *entry;
primitivebranch3:
val = proc(argl);
val = (*proc->primitive_procedure)((void**) argl);
aftercall1:
printf("%u\n", val);
printf("%u\n", val->value);
}