2 * Portions Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
11 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
12 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * Portions Copyright (C) 2001 Nominum, Inc.
19 * Permission to use, copy, modify, and/or distribute this software for any
20 * purpose with or without fee is hereby granted, provided that the above
21 * copyright notice and this permission notice appear in all copies.
23 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
24 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
26 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32 /* $Id: sexpr.h,v 1.11 2007-08-28 07:20:43 tbox Exp $ */
35 #define ISCCC_SEXPR_H 1
37 /*! \file isccc/sexpr.h */
42 #include <isccc/types.h>
46 /*% dotted pair structure */
47 struct isccc_dottedpair {
52 /*% iscc_sexpr structure */
57 isccc_dottedpair_t as_dottedpair;
58 isccc_region_t as_region;
62 #define ISCCC_SEXPRTYPE_NONE 0x00 /*%< Illegal. */
63 #define ISCCC_SEXPRTYPE_T 0x01
64 #define ISCCC_SEXPRTYPE_STRING 0x02
65 #define ISCCC_SEXPRTYPE_DOTTEDPAIR 0x03
66 #define ISCCC_SEXPRTYPE_BINARY 0x04
68 #define ISCCC_SEXPR_CAR(s) (s)->value.as_dottedpair.car
69 #define ISCCC_SEXPR_CDR(s) (s)->value.as_dottedpair.cdr
72 isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr);
75 isccc_sexpr_tconst(void);
78 isccc_sexpr_fromstring(const char *str);
81 isccc_sexpr_frombinary(const isccc_region_t *region);
84 isccc_sexpr_free(isccc_sexpr_t **sexprp);
87 isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream);
90 isccc_sexpr_car(isccc_sexpr_t *list);
93 isccc_sexpr_cdr(isccc_sexpr_t *list);
96 isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car);
99 isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr);
102 isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2);
105 isccc_sexpr_listp(isccc_sexpr_t *sexpr);
108 isccc_sexpr_emptyp(isccc_sexpr_t *sexpr);
111 isccc_sexpr_stringp(isccc_sexpr_t *sexpr);
114 isccc_sexpr_binaryp(isccc_sexpr_t *sexpr);
117 isccc_sexpr_tostring(isccc_sexpr_t *sexpr);
120 isccc_sexpr_tobinary(isccc_sexpr_t *sexpr);
124 #endif /* ISCCC_SEXPR_H */