-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
136 changed files
with
5,027 additions
and
4,621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ fasl/bootp.fasl | |
fasl/ol.fasl | ||
tmp | ||
bin/ol | ||
bin/ol-old | ||
bin/vm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
for FILE in owl/*.scm scheme/*.scm | ||
do | ||
head -n 1 "$FILE" | grep -q "^;;; " || continue | ||
NAME=$(grep "^(define-library " $FILE | head -n 1 | sed -e 's/.define-library //') | ||
echo "## $NAME" | ||
echo "" | ||
grep "^;;;" "$FILE" | sed -re 's/;;; ?//' | ||
echo "" | ||
echo | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* library mode init */ | ||
void init() { | ||
int nobjs=0, nwords=0; | ||
hp = (byte *) &heap; /* builtin heap */ | ||
state = IFALSE; | ||
heap_metrics(&nwords, &nobjs); | ||
max_heap_mb = (W == 4) ? 4096 : 65535; | ||
nwords += nobjs + INITCELLS; | ||
memstart = genstart = fp = (word *) realloc(NULL, (nwords + MEMPAD)*W); | ||
if (!memstart) exit(4); | ||
memend = memstart + nwords - MEMPAD; | ||
state = (word) load_heap(nobjs); | ||
} | ||
|
||
/* bvec → value library call test with preserved state */ | ||
word library_call(size_t len, char *ptr) { | ||
char *pos; | ||
int pads; | ||
word *bvec; | ||
word res; | ||
word program_state = state; | ||
int size; | ||
state = IFALSE; | ||
if (program_state == IFALSE) { | ||
printf("no program state - cannot continue"); | ||
exit(1); | ||
} | ||
if (len > FMAX) { | ||
return (char *) NULL; | ||
} | ||
size = ((len % W) == 0) ? (len/W)+1 : (len/W) + 2; | ||
printf("making an argument byte vector with %d bytes in %d words\n", len, size); | ||
pads = (size-1)*W - len; | ||
bvec = fp; | ||
fp += size; | ||
printf("libary call from state %d\n", state); | ||
*bvec = make_raw_header(size, TBVEC, pads); | ||
pos = ((byte *) bvec) + W; | ||
while(len--) *pos++ = *ptr++; | ||
res = vm(program_state, bvec); | ||
if(fixnump(res)) { | ||
printf("Returned %d\n", fixval(res)); | ||
} else { | ||
printf("Returned descriptor %d\n", res); | ||
} | ||
return res; | ||
} | ||
|
||
int main(int nargs, char **argv) { | ||
init(); | ||
char foo[] = {1, 2, 3}; // 0 | ||
char bar[] = {4, 5}; // 6 | ||
char baz[] = {6, 7, 8, 9}; // 15 | ||
library_call(3, &foo); | ||
library_call(2, &bar); | ||
library_call(4, &baz); | ||
return 0; | ||
} | ||
|
||
|
Oops, something went wrong.