2 * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001 Internet Software Consortium.
4 * Portions Copyright (C) 2001 Nominum, Inc.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* $Id: sexpr.h,v 1.4.18.2 2005/04/29 00:17:14 marka Exp $ */
22 #define ISCCC_SEXPR_H 1
29 #include <isccc/types.h>
33 /*% dotted pair structure */
34 struct isccc_dottedpair {
39 /*% iscc_sexpr structure */
44 isccc_dottedpair_t as_dottedpair;
45 isccc_region_t as_region;
49 #define ISCCC_SEXPRTYPE_NONE 0x00 /*%< Illegal. */
50 #define ISCCC_SEXPRTYPE_T 0x01
51 #define ISCCC_SEXPRTYPE_STRING 0x02
52 #define ISCCC_SEXPRTYPE_DOTTEDPAIR 0x03
53 #define ISCCC_SEXPRTYPE_BINARY 0x04
55 #define ISCCC_SEXPR_CAR(s) (s)->value.as_dottedpair.car
56 #define ISCCC_SEXPR_CDR(s) (s)->value.as_dottedpair.cdr
59 isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr);
62 isccc_sexpr_tconst(void);
65 isccc_sexpr_fromstring(const char *str);
68 isccc_sexpr_frombinary(const isccc_region_t *region);
71 isccc_sexpr_free(isccc_sexpr_t **sexprp);
74 isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream);
77 isccc_sexpr_car(isccc_sexpr_t *list);
80 isccc_sexpr_cdr(isccc_sexpr_t *list);
83 isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car);
86 isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr);
89 isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2);
92 isccc_sexpr_listp(isccc_sexpr_t *sexpr);
95 isccc_sexpr_emptyp(isccc_sexpr_t *sexpr);
98 isccc_sexpr_stringp(isccc_sexpr_t *sexpr);
101 isccc_sexpr_binaryp(isccc_sexpr_t *sexpr);
104 isccc_sexpr_tostring(isccc_sexpr_t *sexpr);
107 isccc_sexpr_tobinary(isccc_sexpr_t *sexpr);
111 #endif /* ISCCC_SEXPR_H */