mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgscm: Make tags mandatory.
* tests/gpgscm/opdefines.h: Make tags mandatory. * tests/gpgscm/scheme.c: Likewise. * tests/gpgscm/scheme.h: Likewise. -- Tags provide a constant-time lookup mechanism for almost every object. This is useful for the interpreter itself, and the code for tags is tiny. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
e1bb9326dc
commit
a1ad5d6a30
@ -154,11 +154,9 @@ _OP_DEF("append", 0, INF_ARG, TST_NONE,
|
||||
_OP_DEF("set-symbol-property!", 3, 3, TST_SYMBOL TST_SYMBOL TST_ANY, OP_SET_SYMBOL_PROPERTY )
|
||||
_OP_DEF("symbol-property", 2, 2, TST_SYMBOL TST_SYMBOL, OP_SYMBOL_PROPERTY )
|
||||
#endif
|
||||
#if USE_TAGS
|
||||
_OP_DEF(0, 0, 0, TST_NONE, OP_TAG_VALUE )
|
||||
_OP_DEF("make-tagged-value", 2, 2, TST_ANY TST_PAIR, OP_MK_TAGGED )
|
||||
_OP_DEF("get-tag", 1, 1, TST_ANY, OP_GET_TAG )
|
||||
#endif
|
||||
_OP_DEF("quit", 0, 1, TST_NUMBER, OP_QUIT )
|
||||
_OP_DEF("gc", 0, 0, 0, OP_GC )
|
||||
_OP_DEF("gc-verbose", 0, 1, TST_NONE, OP_GCVERB )
|
||||
|
@ -671,8 +671,6 @@ copy_value(scheme *sc, pointer dst, pointer src)
|
||||
/* Tags are like property lists, but can be attached to arbitrary
|
||||
* values. */
|
||||
|
||||
#if USE_TAGS
|
||||
|
||||
static pointer
|
||||
mk_tagged_value(scheme *sc, pointer v, pointer tag_car, pointer tag_cdr)
|
||||
{
|
||||
@ -709,14 +707,6 @@ get_tag(scheme *sc, pointer v)
|
||||
return sc->NIL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define mk_tagged_value(SC, X, A, B) (X)
|
||||
#define has_tag(V) 0
|
||||
#define get_tag(SC, V) (SC)->NIL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Low-level allocator.
|
||||
@ -4718,7 +4708,6 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
|
||||
s_return(sc, get_property(sc, car(sc->args), cadr(sc->args)));
|
||||
#endif /* USE_PLIST */
|
||||
|
||||
#if USE_TAGS
|
||||
CASE(OP_TAG_VALUE): { /* not exposed */
|
||||
/* This tags sc->value with car(sc->args). Useful to tag
|
||||
* results of opcode evaluations. */
|
||||
@ -4738,7 +4727,6 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
|
||||
|
||||
CASE(OP_GET_TAG): /* get-tag */
|
||||
s_return(sc, get_tag(sc, car(sc->args)));
|
||||
#endif /* USE_TAGS */
|
||||
|
||||
CASE(OP_QUIT): /* quit */
|
||||
if(is_pair(sc->args)) {
|
||||
@ -4927,12 +4915,12 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
|
||||
} else if (sc->tok == TOK_DOT) {
|
||||
Error_0(sc,"syntax error: illegal dot expression");
|
||||
} else {
|
||||
#if USE_TAGS && SHOW_ERROR_LINE
|
||||
#if SHOW_ERROR_LINE
|
||||
pointer filename;
|
||||
pointer lineno;
|
||||
#endif
|
||||
sc->nesting_stack[sc->file_i]++;
|
||||
#if USE_TAGS && SHOW_ERROR_LINE
|
||||
#if SHOW_ERROR_LINE
|
||||
filename = sc->load_stack[sc->file_i].filename;
|
||||
lineno = sc->load_stack[sc->file_i].curr_line;
|
||||
|
||||
|
@ -44,7 +44,6 @@ extern "C" {
|
||||
# define USE_DL 0
|
||||
# define USE_PLIST 0
|
||||
# define USE_SMALL_INTEGERS 0
|
||||
# define USE_TAGS 0
|
||||
# define USE_HISTORY 0
|
||||
#endif
|
||||
|
||||
@ -78,11 +77,6 @@ extern "C" {
|
||||
# define USE_PLIST 0
|
||||
#endif
|
||||
|
||||
/* If set, then every object can be tagged. */
|
||||
#ifndef USE_TAGS
|
||||
# define USE_TAGS 1
|
||||
#endif
|
||||
|
||||
/* Keep a history of function calls. This enables a feature similar
|
||||
* to stack traces. */
|
||||
#ifndef USE_HISTORY
|
||||
|
Loading…
x
Reference in New Issue
Block a user