2 * Portions Copyright (C) 2004 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.3.206.1 2004/03/06 08:15:22 marka Exp $ */
22 #define ISCCC_SEXPR_H 1
27 #include <isccc/types.h>
31 struct isccc_dottedpair {
40 isccc_dottedpair_t as_dottedpair;
41 isccc_region_t as_region;
45 #define ISCCC_SEXPRTYPE_NONE 0x00 /* Illegal. */
46 #define ISCCC_SEXPRTYPE_T 0x01
47 #define ISCCC_SEXPRTYPE_STRING 0x02
48 #define ISCCC_SEXPRTYPE_DOTTEDPAIR 0x03
49 #define ISCCC_SEXPRTYPE_BINARY 0x04
51 #define ISCCC_SEXPR_CAR(s) (s)->value.as_dottedpair.car
52 #define ISCCC_SEXPR_CDR(s) (s)->value.as_dottedpair.cdr
55 isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr);
58 isccc_sexpr_tconst(void);
61 isccc_sexpr_fromstring(const char *str);
64 isccc_sexpr_frombinary(const isccc_region_t *region);
67 isccc_sexpr_free(isccc_sexpr_t **sexprp);
70 isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream);
73 isccc_sexpr_car(isccc_sexpr_t *list);
76 isccc_sexpr_cdr(isccc_sexpr_t *list);
79 isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car);
82 isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr);
85 isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2);
88 isccc_sexpr_listp(isccc_sexpr_t *sexpr);
91 isccc_sexpr_emptyp(isccc_sexpr_t *sexpr);
94 isccc_sexpr_stringp(isccc_sexpr_t *sexpr);
97 isccc_sexpr_binaryp(isccc_sexpr_t *sexpr);
100 isccc_sexpr_tostring(isccc_sexpr_t *sexpr);
103 isccc_sexpr_tobinary(isccc_sexpr_t *sexpr);
107 #endif /* ISCCC_SEXPR_H */