head 1.7; access; symbols act_first:1.1.1.1 act:1.1.1; locks; strict; comment @ * @; 1.7 date 2003.01.06.12.10.57; author rse; state Exp; branches; next 1.6; 1.6 date 2002.01.02.17.05.53; author rse; state Exp; branches; next 1.5; 1.5 date 2001.03.21.15.59.01; author rse; state Exp; branches; next 1.4; 1.4 date 2000.08.18.21.49.23; author rse; state Exp; branches; next 1.3; 1.3 date 2000.08.18.15.58.08; author rse; state Exp; branches; next 1.2; 1.2 date 2000.08.18.15.35.57; author rse; state Exp; branches; next 1.1; 1.1 date 99.11.12.20.37.19; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.11.12.20.37.19; author rse; state Exp; branches; next ; desc @@ 1.7 log @cleanup source tree @ text @/* ** OSSP act - Abstract Container Types ** Copyright (c) 1999-2003 Ralf S. Engelschall ** Copyright (c) 1999-2003 The OSSP Project ** ** This file is part of OSSP act, an abstract container type library ** which can be found at http://www.ossp.org/pkg/lib/act/. ** ** Permission to use, copy, modify, and distribute this software for ** any purpose with or without fee is hereby granted, provided that ** the above copyright notice and this permission notice appear in all ** copies. ** ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ** SUCH DAMAGE. ** ** act_ctx.h: context structure (declaration) */ #ifndef _ACT_CTX_H_ #define _ACT_CTX_H_ #include "act.h" /* context limits */ #define ACT_CTX_ENTRY_MAX 63 /* the special null context id */ #define ACT_CTX_ID_NULL 0 /* high level context id constructor */ #define ACT_CTX_ID(type,base,indx) \ ACT_CTX_ID_CONS(0,0,act_type_##type,ACT_CTX_BASE_##base+(indx)) /* generate a context id from ingredients */ #define ACT_CTX_ID_CONS(spec,lock,type,indx) \ (__ACT_CTX_ID_SETSPEC(spec)|\ __ACT_CTX_ID_SETLOCK(lock)|\ __ACT_CTX_ID_SETTYPE(type)|\ __ACT_CTX_ID_SETINDX(indx)) /* split a context id into ingredients */ #define ACT_CTX_ID_SPLIT(spec,lock,type,indx,id) \ (spec) = __ACT_CTX_ID_GETSPEC(id);\ (lock) = __ACT_CTX_ID_GETLOCK(id);\ (type) = __ACT_CTX_ID_GETTYPE(id);\ (indx) = __ACT_CTX_ID_GETINDX(id); /* split out the index of a context id only */ #define ACT_CTX_ID_INDEX(id) \ __ACT_CTX_ID_GETINDX(id) /* internal macros */ #define __ACT_CTX_ID_SETSPEC(val) _BM_SET(0,10,10,(val)) #define __ACT_CTX_ID_GETSPEC(id) _BM_GET((id),10,10) #define __ACT_CTX_ID_SETLOCK(val) _BM_SET(0,9,9,(val)) #define __ACT_CTX_ID_GETLOCK(id) _BM_GET((id),9,9) #define __ACT_CTX_ID_SETTYPE(val) _BM_SET(0,8,6,(val)) #define __ACT_CTX_ID_GETTYPE(id) _BM_GET((id),8,6) #define __ACT_CTX_ID_SETINDX(val) _BM_SET(0,5,0,(val)) #define __ACT_CTX_ID_GETINDX(id) _BM_GET((id),5,0) /* pre-defined base numbers for context ids of sub-libraries */ #define ACT_CTX_BASE_CTX 0 #define ACT_CTX_BASE_MEM 10 #define ACT_CTX_BASE_COMMON 15 #define ACT_CTX_BASE_BITS 25 #define ACT_CTX_BASE_ARRAY 30 #define ACT_CTX_BASE_LIST 35 #define ACT_CTX_BASE_BUFFER 40 #define ACT_CTX_BASE_TREE 45 #define ACT_CTX_BASE_HASH 50 #define ACT_CTX_BASE_USER 55 /* the context ids of the ctx sub-library itself */ #define ACT_CTX_CTX_LOCKING ACT_CTX_ID_CONS(1,0,act_type_ptr,ACT_CTX_BASE_CTX+0) #define ACT_CTX_CTX_BINDING ACT_CTX_ID_CONS(1,0,act_type_ptr,ACT_CTX_BASE_CTX+1) #define ACT_CTX_CTX_CALLBACK ACT_CTX_ID_CONS(1,0,act_type_ptr,ACT_CTX_BASE_CTX+2) /* the opaque context data structure */ struct act_ctx_st; typedef struct act_ctx_st act_ctx_t; /* the global default context */ act_ctx_t *act_ctx_default; /* the context API */ extern act_ctx_t *act_ctx_new (void); extern act_ctx_t *act_ctx_dup (act_ctx_t *, act_ctx_t *); extern int act_ctx_set (act_ctx_t *, unsigned int, ...); extern int act_ctx_get (act_ctx_t *, unsigned int, ...); extern void *act_ctx_var (act_ctx_t *, unsigned int); extern int act_ctx_lock (act_ctx_t *, unsigned int); extern int act_ctx_unlock (act_ctx_t *, unsigned int); extern int act_ctx_free (act_ctx_t *); #endif /* _ACT_CTX_H_ */ @ 1.6 log @bump copyright year @ text @d1 4 a4 3 /* ** Act - Abstract Container Type Library ** Copyright (c) 1999-2002 Ralf S. Engelschall d6 2 a7 2 ** This file is part of Act, a library for dealing with Abstract ** Container Types which can be found at http://www.ossp.org/pkg/act/. @ 1.5 log @*** empty log message *** @ text @d3 1 a3 1 ** Copyright (c) 1999-2001 Ralf S. Engelschall @ 1.4 log @*** empty log message *** @ text @d3 1 a3 1 ** Copyright (c) 1999-2000 Ralf S. Engelschall @ 1.3 log @*** empty log message *** @ text @d94 1 a94 1 act_ctx_t *act_ctx_default; @ 1.2 log @*** empty log message *** @ text @d2 2 a3 1 ** act_ctx.h -- ACT context header d5 2 a6 2 ** ==================================================================== ** Copyright (c) 1999-2000 Ralf S. Engelschall. All rights reserved. d8 4 a11 3 ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions ** are met: d13 12 a24 2 ** 1. Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. d26 1 a26 18 ** 2. Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** ** THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY ** EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR ** ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ** OF THE POSSIBILITY OF SUCH DAMAGE. ** ==================================================================== @ 1.1 log @Initial revision @ text @d5 1 a5 1 ** Copyright (c) 1999 Ralf S. Engelschall. All rights reserved. a101 1 @ 1.1.1.1 log @ @ text @@