home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / isccc / sexpr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  2.7 KB  |  112 lines

  1. /*
  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.
  5.  *
  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.
  9.  *
  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.
  17.  */
  18.  
  19. /* $Id: sexpr.h,v 1.4.18.2 2005/04/29 00:17:14 marka Exp $ */
  20.  
  21. #ifndef ISCCC_SEXPR_H
  22. #define ISCCC_SEXPR_H 1
  23.  
  24. /*! \file */
  25.  
  26. #include <stdio.h>
  27.  
  28. #include <isc/lang.h>
  29. #include <isccc/types.h>
  30.  
  31. ISC_LANG_BEGINDECLS
  32.  
  33. /*% dotted pair structure */
  34. struct isccc_dottedpair {
  35.     isccc_sexpr_t *car;
  36.     isccc_sexpr_t *cdr;
  37. };
  38.  
  39. /*% iscc_sexpr structure */
  40. struct isccc_sexpr {
  41.     unsigned int            type;
  42.     union {
  43.         char *            as_string;
  44.         isccc_dottedpair_t    as_dottedpair;
  45.         isccc_region_t        as_region;
  46.     }                value;
  47. };
  48.  
  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
  54.  
  55. #define ISCCC_SEXPR_CAR(s)        (s)->value.as_dottedpair.car
  56. #define ISCCC_SEXPR_CDR(s)        (s)->value.as_dottedpair.cdr
  57.  
  58. isccc_sexpr_t *
  59. isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr);
  60.  
  61. isccc_sexpr_t *
  62. isccc_sexpr_tconst(void);
  63.  
  64. isccc_sexpr_t *
  65. isccc_sexpr_fromstring(const char *str);
  66.  
  67. isccc_sexpr_t *
  68. isccc_sexpr_frombinary(const isccc_region_t *region);
  69.  
  70. void
  71. isccc_sexpr_free(isccc_sexpr_t **sexprp);
  72.  
  73. void
  74. isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream);
  75.  
  76. isccc_sexpr_t *
  77. isccc_sexpr_car(isccc_sexpr_t *list);
  78.  
  79. isccc_sexpr_t *
  80. isccc_sexpr_cdr(isccc_sexpr_t *list);
  81.  
  82. void
  83. isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car);
  84.  
  85. void
  86. isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr);
  87.  
  88. isccc_sexpr_t *
  89. isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2);
  90.  
  91. isc_boolean_t
  92. isccc_sexpr_listp(isccc_sexpr_t *sexpr);
  93.  
  94. isc_boolean_t
  95. isccc_sexpr_emptyp(isccc_sexpr_t *sexpr);
  96.  
  97. isc_boolean_t
  98. isccc_sexpr_stringp(isccc_sexpr_t *sexpr);
  99.  
  100. isc_boolean_t
  101. isccc_sexpr_binaryp(isccc_sexpr_t *sexpr);
  102.  
  103. char *
  104. isccc_sexpr_tostring(isccc_sexpr_t *sexpr);
  105.  
  106. isccc_region_t *
  107. isccc_sexpr_tobinary(isccc_sexpr_t *sexpr);
  108.  
  109. ISC_LANG_ENDDECLS
  110.  
  111. #endif /* ISCCC_SEXPR_H */
  112.