added helpers functions - new release 1.3.1;
This commit is contained in:
parent
766efbd706
commit
70d5123b65
3
.gitignore
vendored
3
.gitignore
vendored
@ -37,3 +37,6 @@ include/version.h
|
|||||||
nbproject
|
nbproject
|
||||||
config.guess.dh-orig
|
config.guess.dh-orig
|
||||||
config.sub.dh-orig
|
config.sub.dh-orig
|
||||||
|
debian/libsexpr*
|
||||||
|
debian/files
|
||||||
|
debian/tmp
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_INIT(libsexpr, 1.3.0)
|
AC_INIT(libsexpr, 1.3.1)
|
||||||
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
|
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,5 +1,11 @@
|
|||||||
|
libsexpr (1.3.1) stable; urgency=medium
|
||||||
|
|
||||||
|
* Release 1.3.1 Added helper functions to operate with S-expressions
|
||||||
|
|
||||||
|
-- Alexander Vdolainen <vdo@askele.com> Wed, 20 May 2015 15:33:00 +0300
|
||||||
|
|
||||||
libsexpr (1.3.0) stable; urgency=low
|
libsexpr (1.3.0) stable; urgency=low
|
||||||
|
|
||||||
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
|
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
|
||||||
|
|
||||||
-- Alexander Vdolainen <vdo@daze> Mon, 24 Nov 2014 11:52:48 +0200
|
-- Alexander Vdolainen <vdo@askele.com> Mon, 24 Nov 2014 11:52:48 +0200
|
||||||
|
2
debian/shlibs.local.ex
vendored
2
debian/shlibs.local.ex
vendored
@ -1 +1 @@
|
|||||||
liblibsexpr 1.3.0 libsexpr (>> 1.3.0), libsexpr (<< 1.3.99)
|
liblibsexpr 1.3.1 libsexpr (>> 1.3.0), libsexpr (<< 1.3.99)
|
||||||
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
|||||||
3.0 (quilt)
|
|
@ -779,6 +779,27 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* sexp helpers */
|
||||||
|
#define SEXP_IS_LIST(sx) \
|
||||||
|
((sx)->ty == SEXP_LIST) ? 1 : 0
|
||||||
|
|
||||||
|
#define SEXP_IS_TYPE(sx,type) \
|
||||||
|
((sx)->ty == SEXP_VALUE && (sx)->aty == (type)) ? 1 : 0
|
||||||
|
|
||||||
|
#define SEXP_ITERATE_LIST(lst, iter, ind) \
|
||||||
|
for((ind) = 0, (iter) = (lst)->list; (ind) < sexp_list_length(lst); \
|
||||||
|
(ind)++, (iter) = (iter)->next)
|
||||||
|
|
||||||
|
/* additional functions to work with sexp */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
int sexp_list_cdr(sexp_t *expr, sexp_t **sx);
|
||||||
|
int sexp_list_car(sexp_t *expr, sexp_t **sx);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sexp_ops.h"
|
#include "sexp_ops.h"
|
||||||
|
|
||||||
#endif /* __SEXP_H__ */
|
#endif /* __SEXP_H__ */
|
||||||
|
23
lib/sexp.c
23
lib/sexp.c
@ -564,3 +564,26 @@ sexp_t *new_sexp_atom(const char *buf, size_t bs, atom_t aty) {
|
|||||||
|
|
||||||
return sx;
|
return sx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* sexp helpers */
|
||||||
|
int sexp_list_car(sexp_t *expr, sexp_t **sx)
|
||||||
|
{
|
||||||
|
if (!SEXP_IS_LIST(expr) || expr->list->ty != SEXP_VALUE) return 1;
|
||||||
|
|
||||||
|
*sx = expr->list;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sexp_list_cdr(sexp_t *expr, sexp_t **sx)
|
||||||
|
{
|
||||||
|
/* Dummy function. Can we do cdr properly? */
|
||||||
|
if (!SEXP_IS_LIST(expr) || expr->list->ty != SEXP_VALUE) return 1;
|
||||||
|
|
||||||
|
if (!expr->list->next) *sx = NULL;
|
||||||
|
else *sx = expr->list->next;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user