summaryrefslogtreecommitdiff
path: root/src/pdflib/pdcore/pc_contain.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdflib/pdcore/pc_contain.h')
-rw-r--r--src/pdflib/pdcore/pc_contain.h81
1 files changed, 72 insertions, 9 deletions
diff --git a/src/pdflib/pdcore/pc_contain.h b/src/pdflib/pdcore/pc_contain.h
index 007bfd0..8b40e18 100644
--- a/src/pdflib/pdcore/pc_contain.h
+++ b/src/pdflib/pdcore/pc_contain.h
@@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
-/* $Id: pc_contain.h,v 1.1 2008/10/17 06:10:43 scuri Exp $
+/* $Id: pc_contain.h,v 1.2 2009/10/20 18:12:26 scuri Exp $
*
* PDFlib generic container classes
*
@@ -47,7 +47,31 @@ void * pdc_avl_insert(pdc_avl *t, const void *item);
void pdc_avl_for_each(const pdc_avl *t, pdc_for_each_cb cb);
-/***************************** vector class *****************************/
+/*************************** bit vector class ****************************/
+
+typedef struct pdc_bvtr_s pdc_bvtr;
+
+typedef struct
+{
+ int init_n_bits; /* initial number of bits */
+ pdc_bool init_value; /* initial bit value */
+ int chunk_size; /* number of bits per chunk */
+ int ctab_incr; /* chunk table increment */
+} pdc_bvtr_parms;
+
+void pdc_bvtr_dflt_parms(pdc_bvtr_parms *vp);
+
+pdc_bvtr * pdc_bvtr_new(pdc_core *pdc, const pdc_bvtr_parms *parms);
+void pdc_bvtr_delete(pdc_bvtr *v);
+
+void pdc_bvtr_resize(pdc_bvtr *v, int n_bits);
+
+pdc_bool pdc_bvtr_getbit(const pdc_bvtr *v, int n);
+void pdc_bvtr_setbit(const pdc_bvtr *v, int n);
+void pdc_bvtr_clrbit(const pdc_bvtr *v, int n);
+
+
+/************************ stack type vector class ************************/
typedef struct pdc_vtr_s pdc_vtr;
@@ -64,17 +88,11 @@ pdc_vtr * pdc_vtr_new(pdc_core *pdc, const pdc_ced *ced, void *context,
const pdc_vtr_parms *parms);
void pdc_vtr_delete(pdc_vtr *v);
+
int pdc_vtr_size(const pdc_vtr *v);
void pdc_vtr_resize(pdc_vtr *v, int size);
void pdc_vtr_pop(pdc_vtr *v);
-/* don't use the pdc__vtr_xxx() functions directly.
-** use the respective pdc_vtr_xxx() macros below.
-*/
-void * pdc__vtr_at(const pdc_vtr *v, int idx);
-void * pdc__vtr_top(const pdc_vtr *v);
-void * pdc__vtr_push(pdc_vtr *v);
-
/* <type> pdc_vtr_at(const pdc_vtr *v, int idx, <type>);
**
@@ -107,4 +125,49 @@ void * pdc__vtr_push(pdc_vtr *v);
#define pdc_vtr_incr(v, type) \
((type *) pdc__vtr_push(v))
+
+/* don't use the pdc__vtr_xxx() functions directly.
+** use the respective pdc_vtr_xxx() macros above.
+*/
+void * pdc__vtr_at(const pdc_vtr *v, int idx);
+void * pdc__vtr_top(const pdc_vtr *v);
+void * pdc__vtr_push(pdc_vtr *v);
+
+
+
+/************************ heap type vector class ************************/
+
+typedef struct pdc_hvtr_s pdc_hvtr;
+
+typedef struct
+{
+ int chunk_size;
+ int ctab_incr;
+} pdc_hvtr_parms;
+
+void pdc_hvtr_dflt_parms(pdc_hvtr_parms *vp);
+
+pdc_hvtr * pdc_hvtr_new(pdc_core *pdc, const pdc_ced *ced, void *context,
+ const pdc_hvtr_parms *parms);
+
+void pdc_hvtr_delete(pdc_hvtr *v);
+
+void pdc_hvtr_release_item(pdc_hvtr *v, int idx);
+int pdc_hvtr_reclaim_item(pdc_hvtr *v);
+pdc_bool pdc_hvtr_check_idx(const pdc_hvtr *v, int idx);
+
+
+/* <type> pdc_hvtr_at(const pdc_hvtr *v, int idx, <type>);
+**
+** (<type>) v[idx]
+*/
+#define pdc_hvtr_at(v, idx, type) \
+ (*((type *) pdc__hvtr_at(v, idx)))
+
+
+/* don't use the pdc__hvtr_xxx() functions directly.
+** use the respective pdc_hvtr_xxx() macros above.
+*/
+void * pdc__hvtr_at(const pdc_hvtr *v, int idx);
+
#endif /* PC_CONTAIN_H */