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.18.17.30.05; author rse; state Exp; branches; next 1.5; 1.5 date 2002.01.02.17.05.53; author rse; state Exp; branches; next 1.4; 1.4 date 2001.03.21.15.59.01; 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.20; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.11.12.20.37.20; 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.h: public Application Programming Interface (API) */ #ifndef _ACT_H_ #define _ACT_H_ /* the library version */ #ifndef ACT_VERSION #define ACT_VERSION @@ACT_VERSION_HEX@@ #endif /* essential headers */ #include /* for ssize_t, off_t */ /* essential typedefs */ @@HAVE_ACT_UINT8_T@@ @@HAVE_ACT_UINT16_T@@ @@HAVE_ACT_UINT32_T@@ @@HAVE_ACT_UINT64_T@@ @@HAVE_ACT_SIZE_T@@ typedef @@ACT_UINT8_T@@ act_uint8_t; typedef @@ACT_UINT16_T@@ act_uint16_t; typedef @@ACT_UINT32_T@@ act_uint32_t; typedef @@ACT_UINT64_T@@ act_uint64_t; typedef @@ACT_SIZE_T@@ act_size_t; /* C++ support */ #ifdef __cplusplus #define BEGIN_DECLARATION extern "C" { #define END_DECLARATION } #else #define BEGIN_DECLARATION /*nop*/ #define END_DECLARATION /*nop*/ #endif /* true and false boolean values */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE /* Do not depend on the exact TRUE value, i.e. never do: x == TRUE. Use TRUE only for return or assignment. */ #define TRUE !FALSE #endif /* null values for pointers and characters */ #ifndef NULL #define NULL ((void *)0) #endif #ifndef NUL #define NUL '\0' #endif /* * Internal Bitmask Calculation Macros * (Notice: bit positions are counted n...0, i.e. lowest bit is position 0) */ /* generate a bitmask consisting of 1 bits from (and including) bit position `l' (left) to (and including) bit position `r' */ #define _BM_MASK(l,r) (((1<<((l)-(r)+1))-1)<<(r)) /* extract a value v from a word w at position `l' to `r' and return value */ #define _BM_GET(w,l,r) (((w)>>(r))&_BM_MASK((l)-(r),0)) /* insert a value v into a word w at position `l' to `r' and return word */ #define _BM_SET(w,l,r,v) ((w)|(((v)&_BM_MASK((l)-(r),0))<<(r))) /* generate a single bit `b' (0 or 1) at bit position `n' */ #define _BM_BIT(n,b) ((b)<<(n)) /* generate a quad word octet of bits (a half byte, i.e. bit positions 3 to 0) */ #define _BM_QUAD(b3,b2,b1,b0) (_BM_BIT(3,(b3))|_BM_BIT(2,(b2))|_BM_BIT(1,(b1))|_BM_BIT(0,(b0))) /* generate an octet word of bits (a byte, i.e. bit positions 7 to 0) */ #define _BM_OCTET(b7,b6,b5,b4,b3,b2,b1,b0) ((_BM_QUAD(b7,b6,b5,b4)<<4)|_BM_QUAD(b3,b2,b1,b0)) /* generate the value 2^n */ #define _BM_POW2(n) _BM_BIT(1,n) /* shift word w k bits to the left or to the right */ #define _BM_SHL(w,k) ((w)<<(k)) #define _BM_SHR(w,k) ((w)>>(k)) /* rotate word w (of bits n..0) k bits to the left or to the right */ #define _BM_ROL(w,n,k) (_BM_SHL((w),(k))&_BM_MASK(n,0))|_BM_SHR(((w)&_BM_MASK(n,0)),(n)-(k)) #define _BM_ROR(w,n,k) (_BM_SHR(((w)&_BM_MASK(n,0)),(k)))|_BM_SHL(((w),(n)-(k))&_BM_MASK(n,0)) /* * Some math functions */ #ifndef _M_MIN #define _M_MIN(a,b) (((a)<(b)) ? (a) : (b)) #endif #ifndef _M_MAX #define _M_MAX(a,b) (((a)>(b)) ? (a) : (b)) #endif #ifndef _M_ABS #define _M_ABS(a) (((a)>0) ? (a) : -(a)) #endif #ifndef _M_ALIGN #define _M_ALIGN(a) (((unsigned long int)(a)+(sizeof((void *)-1)))&(~(sizeof((void *)-1)))) #endif /* * A hacker macro for finding the offset of a `field' * in a structure of type `type'. */ #define _OffsetOf(type,s_field) \ ((unsigned int)(((char *)(&(((type *)0)->field)))-((char *)0))) /* * ACT data types */ enum act_type_en { act_type_ptr, act_type_int, act_type_long, act_type_double }; typedef enum act_type_en act_type_t; /* * Act return types */ typedef enum { ACT_OK = 0, ACT_ERR_ARG, ACT_ERR_USE, ACT_ERR_INT, ACT_ERR_IMP, ACT_ERR_SYS } act_rc_t; /* * ??? */ /* additional errno values */ #define ACT_E_NOMEM 0 #define ACT_E_INVAL 0 #define ACT_E_INTERN 0 /* positions */ #define ACT_POS_ABOVE 0 #define ACT_POS_BELOW 0 #define ACT_POS_BEFORE 0 #define ACT_POS_AFTER 0 /* walking */ #define ACT_MOV_PARENT 0 #define ACT_MOV_CHILD(n) 0 #define ACT_MOV_PREV 0 #define ACT_MOV_NEXT 0 /* boolean type */ typedef unsigned short int act_bool_t; #define ACT_CTX_KEY_SIZE ACT_CTX_ID(int,COMMON,0) #define ACT_CTX_KEY_LOAN ACT_CTX_ID(int,COMMON,1) #define ACT_CTX_KEY_ISPTR ACT_CTX_ID(int,COMMON,2) #define ACT_CTX_VAL_SIZE ACT_CTX_ID(int,COMMON,3) #define ACT_CTX_VAL_LOAN ACT_CTX_ID(int,COMMON,4) #define ACT_CTX_VAL_ISPTR ACT_CTX_ID(int,COMMON,5) #define ACT_CTX_VAL_EXPECT ACT_CTX_ID(int,COMMON,6) #include "act_lib.h" #include "act_ctx.h" #endif /* _ACT_H_ */ @ 1.6 log @provide a few macros and return codes @ 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/. d67 1 a67 1 /* Do not depend on the exact TRUE value, i.e. never do: x == TRUE. d80 1 a80 1 /* @ 1.5 log @bump copyright year @ text @d150 12 @ 1.4 log @*** empty log message *** @ text @d3 1 a3 1 ** Copyright (c) 1999-2001 Ralf S. Engelschall @ 1.3 log @*** empty log message *** @ text @d3 1 a3 1 ** Copyright (c) 1999-2000 Ralf S. Engelschall @ 1.2 log @*** empty log message *** @ text @d2 2 a3 1 ** act.h -- ACT API 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. @ 1.1.1.1 log @ @ text @@