diff options
author | Justus Winter <[email protected]> | 2017-03-29 11:47:54 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-04-10 12:57:18 +0000 |
commit | 4f835104b9475e7d585d859b85e7d0d4cfe9aab3 (patch) | |
tree | 9b7d53395ea343c56ca4e7ab88dd8738ec7249a9 | |
parent | gpgscm: Merge 'opexe_3'. (diff) | |
download | gnupg-4f835104b9475e7d585d859b85e7d0d4cfe9aab3.tar.gz gnupg-4f835104b9475e7d585d859b85e7d0d4cfe9aab3.zip |
gpgscm: Merge 'opexe_4'.
* tests/gpgscm/scheme.c (opexe_4): Merge into 'opexe_0'.
* tests/gpgscm/opdefines.h: Adapt.
--
Having separate functions to execute opcodes reduces our ability to
thread the code and prevents the dispatch_table from being moved to
rodata.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | tests/gpgscm/opdefines.h | 68 | ||||
-rw-r--r-- | tests/gpgscm/scheme.c | 15 |
2 files changed, 37 insertions, 46 deletions
diff --git a/tests/gpgscm/opdefines.h b/tests/gpgscm/opdefines.h index f4e5280e9..7bdaefb13 100644 --- a/tests/gpgscm/opdefines.h +++ b/tests/gpgscm/opdefines.h @@ -138,46 +138,46 @@ _OP_DEF(opexe_0, "vector?", 1, 1, TST_ANY, OP_VECTORP ) _OP_DEF(opexe_0, "eq?", 2, 2, TST_ANY, OP_EQ ) _OP_DEF(opexe_0, "eqv?", 2, 2, TST_ANY, OP_EQV ) - _OP_DEF(opexe_4, "force", 1, 1, TST_ANY, OP_FORCE ) - _OP_DEF(opexe_4, 0, 0, 0, 0, OP_SAVE_FORCED ) - _OP_DEF(opexe_4, "write", 1, 2, TST_ANY TST_OUTPORT, OP_WRITE ) - _OP_DEF(opexe_4, "write-char", 1, 2, TST_CHAR TST_OUTPORT, OP_WRITE_CHAR ) - _OP_DEF(opexe_4, "display", 1, 2, TST_ANY TST_OUTPORT, OP_DISPLAY ) - _OP_DEF(opexe_4, "newline", 0, 1, TST_OUTPORT, OP_NEWLINE ) - _OP_DEF(opexe_4, "error", 1, INF_ARG, TST_NONE, OP_ERR0 ) - _OP_DEF(opexe_4, 0, 0, 0, 0, OP_ERR1 ) - _OP_DEF(opexe_4, "reverse", 1, 1, TST_LIST, OP_REVERSE ) - _OP_DEF(opexe_4, "list*", 1, INF_ARG, TST_NONE, OP_LIST_STAR ) - _OP_DEF(opexe_4, "append", 0, INF_ARG, TST_NONE, OP_APPEND ) + _OP_DEF(opexe_0, "force", 1, 1, TST_ANY, OP_FORCE ) + _OP_DEF(opexe_0, 0, 0, 0, 0, OP_SAVE_FORCED ) + _OP_DEF(opexe_0, "write", 1, 2, TST_ANY TST_OUTPORT, OP_WRITE ) + _OP_DEF(opexe_0, "write-char", 1, 2, TST_CHAR TST_OUTPORT, OP_WRITE_CHAR ) + _OP_DEF(opexe_0, "display", 1, 2, TST_ANY TST_OUTPORT, OP_DISPLAY ) + _OP_DEF(opexe_0, "newline", 0, 1, TST_OUTPORT, OP_NEWLINE ) + _OP_DEF(opexe_0, "error", 1, INF_ARG, TST_NONE, OP_ERR0 ) + _OP_DEF(opexe_0, 0, 0, 0, 0, OP_ERR1 ) + _OP_DEF(opexe_0, "reverse", 1, 1, TST_LIST, OP_REVERSE ) + _OP_DEF(opexe_0, "list*", 1, INF_ARG, TST_NONE, OP_LIST_STAR ) + _OP_DEF(opexe_0, "append", 0, INF_ARG, TST_NONE, OP_APPEND ) #if USE_PLIST - _OP_DEF(opexe_4, "set-symbol-property!", 3, 3, TST_SYMBOL TST_SYMBOL TST_ANY, OP_SET_SYMBOL_PROPERTY ) - _OP_DEF(opexe_4, "symbol-property", 2, 2, TST_SYMBOL TST_SYMBOL, OP_SYMBOL_PROPERTY ) + _OP_DEF(opexe_0, "set-symbol-property!", 3, 3, TST_SYMBOL TST_SYMBOL TST_ANY, OP_SET_SYMBOL_PROPERTY ) + _OP_DEF(opexe_0, "symbol-property", 2, 2, TST_SYMBOL TST_SYMBOL, OP_SYMBOL_PROPERTY ) #endif #if USE_TAGS - _OP_DEF(opexe_4, NULL, 0, 0, TST_NONE, OP_TAG_VALUE ) - _OP_DEF(opexe_4, "make-tagged-value", 2, 2, TST_ANY TST_PAIR, OP_MK_TAGGED ) - _OP_DEF(opexe_4, "get-tag", 1, 1, TST_ANY, OP_GET_TAG ) + _OP_DEF(opexe_0, NULL, 0, 0, TST_NONE, OP_TAG_VALUE ) + _OP_DEF(opexe_0, "make-tagged-value", 2, 2, TST_ANY TST_PAIR, OP_MK_TAGGED ) + _OP_DEF(opexe_0, "get-tag", 1, 1, TST_ANY, OP_GET_TAG ) #endif - _OP_DEF(opexe_4, "quit", 0, 1, TST_NUMBER, OP_QUIT ) - _OP_DEF(opexe_4, "gc", 0, 0, 0, OP_GC ) - _OP_DEF(opexe_4, "gc-verbose", 0, 1, TST_NONE, OP_GCVERB ) - _OP_DEF(opexe_4, "new-segment", 0, 1, TST_NUMBER, OP_NEWSEGMENT ) - _OP_DEF(opexe_4, "oblist", 0, 0, 0, OP_OBLIST ) - _OP_DEF(opexe_4, "current-input-port", 0, 0, 0, OP_CURR_INPORT ) - _OP_DEF(opexe_4, "current-output-port", 0, 0, 0, OP_CURR_OUTPORT ) - _OP_DEF(opexe_4, "open-input-file", 1, 1, TST_STRING, OP_OPEN_INFILE ) - _OP_DEF(opexe_4, "open-output-file", 1, 1, TST_STRING, OP_OPEN_OUTFILE ) - _OP_DEF(opexe_4, "open-input-output-file", 1, 1, TST_STRING, OP_OPEN_INOUTFILE ) + _OP_DEF(opexe_0, "quit", 0, 1, TST_NUMBER, OP_QUIT ) + _OP_DEF(opexe_0, "gc", 0, 0, 0, OP_GC ) + _OP_DEF(opexe_0, "gc-verbose", 0, 1, TST_NONE, OP_GCVERB ) + _OP_DEF(opexe_0, "new-segment", 0, 1, TST_NUMBER, OP_NEWSEGMENT ) + _OP_DEF(opexe_0, "oblist", 0, 0, 0, OP_OBLIST ) + _OP_DEF(opexe_0, "current-input-port", 0, 0, 0, OP_CURR_INPORT ) + _OP_DEF(opexe_0, "current-output-port", 0, 0, 0, OP_CURR_OUTPORT ) + _OP_DEF(opexe_0, "open-input-file", 1, 1, TST_STRING, OP_OPEN_INFILE ) + _OP_DEF(opexe_0, "open-output-file", 1, 1, TST_STRING, OP_OPEN_OUTFILE ) + _OP_DEF(opexe_0, "open-input-output-file", 1, 1, TST_STRING, OP_OPEN_INOUTFILE ) #if USE_STRING_PORTS - _OP_DEF(opexe_4, "open-input-string", 1, 1, TST_STRING, OP_OPEN_INSTRING ) - _OP_DEF(opexe_4, "open-input-output-string", 1, 1, TST_STRING, OP_OPEN_INOUTSTRING ) - _OP_DEF(opexe_4, "open-output-string", 0, 1, TST_STRING, OP_OPEN_OUTSTRING ) - _OP_DEF(opexe_4, "get-output-string", 1, 1, TST_OUTPORT, OP_GET_OUTSTRING ) + _OP_DEF(opexe_0, "open-input-string", 1, 1, TST_STRING, OP_OPEN_INSTRING ) + _OP_DEF(opexe_0, "open-input-output-string", 1, 1, TST_STRING, OP_OPEN_INOUTSTRING ) + _OP_DEF(opexe_0, "open-output-string", 0, 1, TST_STRING, OP_OPEN_OUTSTRING ) + _OP_DEF(opexe_0, "get-output-string", 1, 1, TST_OUTPORT, OP_GET_OUTSTRING ) #endif - _OP_DEF(opexe_4, "close-input-port", 1, 1, TST_INPORT, OP_CLOSE_INPORT ) - _OP_DEF(opexe_4, "close-output-port", 1, 1, TST_OUTPORT, OP_CLOSE_OUTPORT ) - _OP_DEF(opexe_4, "interaction-environment", 0, 0, 0, OP_INT_ENV ) - _OP_DEF(opexe_4, "current-environment", 0, 0, 0, OP_CURR_ENV ) + _OP_DEF(opexe_0, "close-input-port", 1, 1, TST_INPORT, OP_CLOSE_INPORT ) + _OP_DEF(opexe_0, "close-output-port", 1, 1, TST_OUTPORT, OP_CLOSE_OUTPORT ) + _OP_DEF(opexe_0, "interaction-environment", 0, 0, 0, OP_INT_ENV ) + _OP_DEF(opexe_0, "current-environment", 0, 0, 0, OP_CURR_ENV ) _OP_DEF(opexe_5, "read", 0, 1, TST_INPORT, OP_READ ) _OP_DEF(opexe_5, "read-char", 0, 1, TST_INPORT, OP_READ_CHAR ) _OP_DEF(opexe_5, "peek-char", 0, 1, TST_INPORT, OP_PEEK_CHAR ) diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index e3f06de25..48e0f3fd2 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -438,7 +438,6 @@ static pointer reverse_in_place(scheme *sc, pointer term, pointer list); static pointer revappend(scheme *sc, pointer a, pointer b); static void dump_stack_mark(scheme *); static pointer opexe_0(scheme *sc, enum scheme_opcodes op); -static pointer opexe_4(scheme *sc, enum scheme_opcodes op); static pointer opexe_5(scheme *sc, enum scheme_opcodes op); static pointer opexe_6(scheme *sc, enum scheme_opcodes op); static void Eval_Cycle(scheme *sc, enum scheme_opcodes op); @@ -4633,17 +4632,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_retbool(car(sc->args) == cadr(sc->args)); CASE(OP_EQV): /* eqv? */ s_retbool(eqv(car(sc->args), cadr(sc->args))); - default: - snprintf(sc->strbuff,STRBUFFSIZE,"%d: illegal operator", sc->op); - Error_0(sc,sc->strbuff); - } - return sc->T; -} -static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { - pointer x, y; - - switch (op) { CASE(OP_FORCE): /* force */ sc->code = car(sc->args); if (is_promise(sc->code)) { @@ -4823,7 +4812,6 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } s_return(sc,p); break; - default: assert (! "reached"); } #if USE_STRING_PORTS @@ -4889,6 +4877,9 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { CASE(OP_CURR_ENV): /* current-environment */ s_return(sc,sc->envir); + default: + snprintf(sc->strbuff,STRBUFFSIZE,"%d: illegal operator", sc->op); + Error_0(sc,sc->strbuff); } return sc->T; } |