diff options
author | Niels Möller <nisse@lysator.liu.se> | 2002-09-29 23:02:29 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2002-09-29 23:02:29 +0200 |
commit | d2c2a1fd6cfdc3e1d1a9c9b05cd04751d3763a57 (patch) | |
tree | ec7d8f19a40fbfdf4c4e29e3504bdf4e4cf7b61b /sexp.h | |
parent | dc652126c9357bead1e91c09c45eb1d0677b2b01 (diff) | |
download | nettle-d2c2a1fd6cfdc3e1d1a9c9b05cd04751d3763a57.tar.gz |
(sexp_iterator_assoc): Don't enter the list, associate
keys within the current list. Still exit the list when done.
(sexp_iterator_assoc): Represent keys as plain NUL-terminated
strings.
(sexp_iterator_check_type, sexp_iterator_check_types): New
functions.
Rev: src/nettle/sexp.c:1.4
Rev: src/nettle/sexp.h:1.3
Diffstat (limited to 'sexp.h')
-rw-r--r-- | sexp.h | 34 |
1 files changed, 27 insertions, 7 deletions
@@ -50,11 +50,6 @@ struct sexp_iterator const uint8_t *atom; }; -struct sexp_assoc_key -{ - unsigned length; - const uint8_t *name; -}; /* Initializes the iterator. You have to call next to get to the first * element. */ @@ -74,17 +69,42 @@ sexp_iterator_enter_list(struct sexp_iterator *iterator); int sexp_iterator_exit_list(struct sexp_iterator *iterator); + +/* Checks the type of the current expression, which should be a list + * + * (<type> ...) + */ +int +sexp_iterator_check_type(struct sexp_iterator *iterator, + const uint8_t *type); + +const uint8_t * +sexp_iterator_check_types(struct sexp_iterator *iterator, + unsigned ntypes, + const uint8_t **types); + /* Current element must be a list. Looks up element of type * * (key rest...) * - * For a matching key, the corersponding iterator is initialized + * For a matching key, the corresponding iterator is initialized * pointing at the start of REST. */ int sexp_iterator_assoc(struct sexp_iterator *iterator, unsigned nkeys, - const struct sexp_assoc_key *keys, + const uint8_t **keys, struct sexp_iterator *values); + +/* Output functions. What is a reasonable API for this? It seems + * ugly to have to reimplement string streams. */ + +/* Declared for real in buffer.h */ +struct nettle_buffer; + +int +sexp_format(struct nettle_buffer *buffer, const char *format, ...); + + #endif /* NETTLE_SEXP_H_INCLUDED */ |