diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-11-27 19:08:13 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-11-27 19:08:13 +0100 |
commit | ae5697bb352f9aed8522661de37c153828ed6906 (patch) | |
tree | a734345d9f40373f30438c905359ddf563b985ff /debian/patches/bootshell0005-bootshell-add-facility-to-load-embedded-scripts.patch | |
parent | 5ef2ca66bc3a305bd6fc96ca14579415a4b50b25 (diff) |
add patch series
Diffstat (limited to 'debian/patches/bootshell0005-bootshell-add-facility-to-load-embedded-scripts.patch')
-rw-r--r-- | debian/patches/bootshell0005-bootshell-add-facility-to-load-embedded-scripts.patch | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/debian/patches/bootshell0005-bootshell-add-facility-to-load-embedded-scripts.patch b/debian/patches/bootshell0005-bootshell-add-facility-to-load-embedded-scripts.patch new file mode 100644 index 00000000..32bf8354 --- /dev/null +++ b/debian/patches/bootshell0005-bootshell-add-facility-to-load-embedded-scripts.patch @@ -0,0 +1,83 @@ +From 208ce325d26d4393bd69e7d491891a25c4f5461a Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 24 Jan 2015 01:54:52 +0100 +Subject: [PATCH hurd 05/11] bootshell: add facility to load embedded scripts + +* bootshell/scheme.c (scheme_load_mem): New function. +--- + bootshell/scheme-private.h | 3 +++ + bootshell/scheme.c | 40 ++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 43 insertions(+) + +diff --git a/bootshell/scheme-private.h b/bootshell/scheme-private.h +index 3395328..bb4ebd6 100644 +--- a/bootshell/scheme-private.h ++++ b/bootshell/scheme-private.h +@@ -36,6 +36,9 @@ typedef struct port { + char *start; + char *past_the_end; + char *curr; ++#if SHOW_ERROR_LINE ++ const char *name; ++#endif + } string; + } rep; + } port; +diff --git a/bootshell/scheme.c b/bootshell/scheme.c +index 99f9106..bdeb004 100644 +--- a/bootshell/scheme.c ++++ b/bootshell/scheme.c +@@ -2312,6 +2312,18 @@ static pointer _Error_1(scheme *sc, const char *s, pointer a) { + snprintf(sbuf, STRBUFFSIZE, "(%s : %i) %s", fname, ln, s); + + str = (const char*)sbuf; ++ } else if (sc->load_stack[sc->file_i].kind & port_string) { ++ const char *start = sc->load_stack[sc->file_i].rep.string.start; ++ const char *curr = sc->load_stack[sc->file_i].rep.string.curr; ++ const char *name = sc->load_stack[sc->file_i].rep.string.name; ++ ++ /* should never happen */ ++ if (!name) name = "<unknown>"; ++ ++ /* we started from 0 */ ++ snprintf(sbuf, STRBUFFSIZE, "(%s offset %i) %s", name, curr-start, s); ++ ++ str = (const char*)sbuf; + } + #endif + +@@ -5049,3 +5061,31 @@ Local variables: + c-file-style: "k&r" + End: + */ ++ ++/* Like scheme_load_string, but does not rely on a terminating zero. */ ++void ++scheme_load_mem (scheme *sc, const char *cmd_start, const char *cmd_end, ++ const char *name) ++{ ++ dump_stack_reset(sc); ++ sc->envir = sc->global_env; ++ sc->file_i=0; ++ sc->load_stack[0].kind=port_input|port_string; ++ /* This func respects const */ ++ sc->load_stack[0].rep.string.start=(char*) cmd_start; ++ sc->load_stack[0].rep.string.past_the_end=(char*) cmd_end; ++ sc->load_stack[0].rep.string.curr=(char*) cmd_start; ++#if SHOW_ERROR_LINE ++ sc->load_stack[0].rep.string.name = name; ++#endif ++ sc->loadport=mk_port(sc,sc->load_stack); ++ sc->retcode=0; ++ sc->interactive_repl=0; ++ sc->inport=sc->loadport; ++ sc->args = mk_integer(sc,sc->file_i); ++ Eval_Cycle(sc, OP_T0LVL); ++ typeflag(sc->loadport)=T_ATOM; ++ if(sc->retcode==0) { ++ sc->retcode=sc->nesting!=0; ++ } ++} +-- +2.1.4 + |