/* name: chtml.h purpose: declare interface to compiled smart html templates author: George J. Carrette, Platform Development Group. note: this is a low-footprint way of dealing with a subset of the data and functionality provided by libsiod.so. COPYRIGHT (c) 1995-1996 BY NEWS INTERNET SERVICES ALL RIGHTS RESERVED. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation, and that the name of News Internet Services not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THIS SOFTWARE IS MADE AVAILABLE WITHOUT CHARGE, AS-IS. NEWS INTERNET SERVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEWS INTERNET BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ enum CHTML_TYPE { CHTML_ILLEGAL, CHTML_NUMBER, CHTML_SYMBOL, CHTML_STRING, CHTML_ARRAY}; struct chtml {enum CHTML_TYPE type; int length; union {struct {void *ptr;} ptv; struct {int value;} number; struct {char *name;} symbol; struct {char *value;} string; struct {struct chtml **data;} array;} storage_as;}; struct chtml *chtml_fload(FILE *); struct chtml *chtml_load(char *,char *); void chtml_free(struct chtml *); void chtml_debug_print(struct chtml *,FILE *); char *chtml_ident(void); char *chtml_html_encode(char *,char *); char *chtml_url_encode(char *,char *); char *chtml_url_decode(char *,char *); void chtml_memfree(void *); struct chtml *chtml_object(char *,struct chtml *); void chtml_do_write(char *(*)(char *,void *), void *, struct chtml *, void (*)(char *,void *), void *); long chtml_size_write(char *(*)(char *,void *), void *, struct chtml *); long chtml_size_write_limit(char *(*)(char *,void *), void *, struct chtml *, long); struct chtml_str {char *value; struct chtml_str *next;}; typedef struct chtml_stritem {char *name; int namelen; struct chtml_str *first; struct chtml_str *last; struct chtml_str *current; struct chtml_stritem **place; struct chtml_stritem *next;} *CHTML_STRITEM; CHTML_STRITEM chtml_stritem_init(char *,CHTML_STRITEM *,CHTML_STRITEM *); void chtml_stritem_insert(CHTML_STRITEM,char *,char *); void chtml_stritem_update(CHTML_STRITEM,char *,char *); long chtml_stritem_len(CHTML_STRITEM); void chtml_stritem_free(CHTML_STRITEM *); void chtml_stritem_rewind(CHTML_STRITEM); char *chtml_stritem_get(char *,CHTML_STRITEM); CHTML_STRITEM chtml_stritem_getem(char *,CHTML_STRITEM); void chtml_stritem_kinsert(CHTML_STRITEM *,char *,char *,char *); void chtml_stritem_kupdate(CHTML_STRITEM *,char *,char *,char *); void chtml_stritem_debug_print(CHTML_STRITEM); void chtml_stritem_kinsert_qs(CHTML_STRITEM *,char *); void chtml_stritem_kinsertl(CHTML_STRITEM *,char *,long); int chtml_stritem_available(char *,CHTML_STRITEM); int chtml_stritem_locate(char *,CHTML_STRITEM); char *chtml_stritem_eval(char *,CHTML_STRITEM); void chtml_stritem_copy(CHTML_STRITEM *,CHTML_STRITEM,char *); CHTML_STRITEM chtml_stritem_getemsub(char *,char *,CHTML_STRITEM); char *chtml_url_encode_cb(char *str,char *aend,char *(*fcn)(size_t,void *), void *cb_arg); char *chtml_url_decode_cb(char *str,char *aend, char *(*fcn)(size_t,void *),void *cb_arg); char *chtml_html_encode_cb(char *str,char *aend, char *(*fcn)(size_t,void *),void *cb_arg); void chtml_stritem_kinsertlr(CHTML_STRITEM *table,char *k,long start,long end); long chtml_stritem_available_len(char *key,CHTML_STRITEM table); char *chtml_stritem_get_qs(CHTML_STRITEM table,char *buffer,size_t buflen, ...); char *chtml_stritem_getd(char *key,CHTML_STRITEM tbl,char *defaultv);