#include #include /* Ns_Set data structures */ typedef struct ns_set { long sentinel; int flags; char *name; table *real_table; pool *key_pool; pool *value_pool; } Ns_Set; #define ns_set_table(s) (ap_table_elts((s)->real_table)) #define ns_set_elts(s) ((table_entry *)(ns_set_table(s)->elts)) /* Return a new ns_set */ Ns_Set *ns_set_create_internal (char *name, table *t); /* Communicating them to tcl --- building and parsing string handles * for sets. */ void ns_enter_set (Tcl_Interp *interp, Ns_Set *set_ptr); Ns_Set *ns_unpack_handle (char *handle); /* And finally aolserver emulation defined in terms of the above */ #define NS_TCL_SET_TEMPORARY 0 #define NS_TCL_SET_DYNAMIC 1 #define NS_TCL_SET_PERSISTENT NS_TCL_SET_PERSISTENT_NOT_SUPPORTED_YOU_LOSE #define Ns_SetName(s) ((s)->name) #define Ns_SetSize(s) (ns_set_table(s)->nelts) #define Ns_SetLast(s) (ns_set_table(s)->nelts - 1) #define Ns_SetKey(s,i) (ns_set_elts(s)[i].key) #define Ns_SetValue(s,i) (ns_set_elts(s)[i].val) #define Ns_SetPool(s) (ns_set_table(s)->pool) /* Apache only! */ Ns_Set *Ns_SetCreate (char *name); /* Allocated in TCL_POOL() */ void Ns_SetFree (Ns_Set *set); void Ns_SetUpdate (Ns_Set *set, char *key, char *value); int Ns_SetPut (Ns_Set *set, char *key, char *value); int Ns_SetUniqueCmp (Ns_Set *set, char *key, int (*cmp) (const char*, const char*)); int Ns_SetUnique (Ns_Set *s, char* k); int Ns_SetIUnique (Ns_Set *s, char* k); int Ns_SetFindCmp (Ns_Set *set, char *key, int (*cmp) (const char *, const char *)); int Ns_SetFind (Ns_Set *set, char *key); int Ns_SetIFind (Ns_Set *set, char *key); char *Ns_SetGetCmp (Ns_Set *set, char *key, int (*cmp) (const char *, const char *)); char *Ns_SetGet (Ns_Set *set, char *key); char *Ns_SetIGet (Ns_Set *set, char *key); void Ns_SetTrunc (Ns_Set *set, int size); void Ns_SetClearValuesOnPutValue (Ns_Set *set); void Ns_SetClearValues (Ns_Set *set); void Ns_SetDelete (Ns_Set *set, int index); void Ns_SetPutValue (Ns_Set *set, int index, char *value); void Ns_SetDeleteKey (Ns_Set *set, char *key); void Ns_SetIDeleteKey (Ns_Set *set, char *key); void Ns_SetMerge (Ns_Set *high, Ns_Set *low); Ns_Set *Ns_SetCopy (Ns_Set *s); void Ns_SetMove (Ns_Set *to, Ns_Set *from); void Ns_SetPrint (Ns_Set *set); int Ns_ParseHeader(Ns_Set *set, char *line, Ns_HeaderCaseDisposition disp); int Ns_TclEnterSet(Tcl_Interp *interp, Ns_Set *set, int flags); Ns_Set *Ns_TclGetSet(Tcl_Interp *interp, char *setId); int Ns_TclGetSet2(Tcl_Interp *interp, char *setId, Ns_Set **setPtrPtr); /* Finally, the tcl command */ ns_tcl_command NsTclSetCmd; ns_tcl_command NsTclParseHeaderCmd;