Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
add pic_boot function
Browse files Browse the repository at this point in the history
  • Loading branch information
nyuichi committed Mar 3, 2016
1 parent c27ce69 commit 85b58bd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
22 changes: 20 additions & 2 deletions extlib/benz/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,10 @@ foreach (@data) {
print "\n#endif\n\n";
print <<EOL;
const char pic_boot[][80] = {
#include "picrin.h"
#include "picrin/extra.h"
static const char boot_rom[][80] = {
EOL
my @lines = $src =~ /.{0,80}/gs;
Expand All @@ -715,6 +718,12 @@ print "\"\"\n";
print <<EOL;
};

void
pic_boot(pic_state *pic)
{
pic_load_cstr(pic, &boot_rom[0][0]);
}

#if 0
Local Variables:
mode: scheme
Expand All @@ -730,7 +739,10 @@ EOL

#endif

const char pic_boot[][80] = {
#include "picrin.h"
#include "picrin/extra.h"

static const char boot_rom[][80] = {
"\n(builtin:define-macro call-with-current-environment\n (builtin:lambda (form env",
")\n (list (cadr form) env)))\n\n(builtin:define here\n (call-with-current-enviro",
"nment\n (builtin:lambda (env)\n env)))\n\n(builtin:define the ",
Expand Down Expand Up @@ -1033,6 +1045,12 @@ const char pic_boot[][80] = {
""
};

void
pic_boot(pic_state *pic)
{
pic_load_cstr(pic, &boot_rom[0][0]);
}

#if 0
Local Variables:
mode: scheme
Expand Down
17 changes: 6 additions & 11 deletions extlib/benz/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,18 @@ void pic_init_eval(pic_state *);
void pic_init_lib(pic_state *);
void pic_init_weak(pic_state *);

extern const char pic_boot[][80];
void pic_boot(pic_state *);

#define DONE pic_leave(pic, ai);

static void
pic_init_core(pic_state *pic)
{
size_t ai;
size_t ai = pic_enter(pic);
pic_value env;

pic_deflibrary(pic, "picrin.base");

ai = pic_enter(pic);

#define DONE pic_leave(pic, ai);

env = pic_library_environment(pic, pic->lib);

import_builtin_syntax("define");
Expand All @@ -133,8 +131,7 @@ pic_init_core(pic_state *pic)
import_builtin_syntax("begin");
import_builtin_syntax("define-macro");

DONE;

pic_init_features(pic); DONE;
pic_init_bool(pic); DONE;
pic_init_pair(pic); DONE;
pic_init_port(pic); DONE;
Expand All @@ -159,9 +156,7 @@ pic_init_core(pic_state *pic)
pic_init_write(pic); DONE;
#endif

pic_init_features(pic);

pic_load_cstr(pic, &pic_boot[0][0]);
pic_boot(pic); DONE;
}

pic_state *
Expand Down

0 comments on commit 85b58bd

Please sign in to comment.