~ubuntu-branches/ubuntu/dapper/malaga/dapper

« back to all changes in this revision

Viewing changes to pools.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2005-01-10 11:52:04 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110115204-hpgncw5pb0m1t8i6
Tags: 6.13-5
debian/control (malaga-doc Recommends): Suggest gv as a
postscript-viewer instead of ghostview.  (Closes: #289701).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 1995 Bjoern Beutel. */
 
2
 
 
3
/* Description. =============================================================*/
 
4
 
 
5
/* This module defines a new data type, "pool_t", for growing vectors of items 
 
6
 * of an arbitrary type. */
 
7
 
 
8
/* Types. ===================================================================*/
 
9
 
 
10
typedef struct POOL_T *pool_t; /* The abstract data type. */
 
11
 
 
12
/* Functions. ===============================================================*/
 
13
 
 
14
extern pool_t new_pool( int_t item_size );
 
15
/* Create a new pool that records items of size ITEM_SIZE. */
 
16
 
 
17
extern void free_pool( pool_t *pool );
 
18
/* Free all memory used by *POOL. */
 
19
 
 
20
extern void clear_pool( pool_t pool );
 
21
/* Clear POOL. */
 
22
 
 
23
extern void *pool_to_vector( pool_t pool );
 
24
/* Return POOL as a C vector (contiguous memory).
 
25
 * The vector must be freed after use. */
 
26
 
 
27
extern void write_pool( pool_t pool, FILE *stream, string_t file_name );
 
28
/* Write POOL to STREAM. FILE_NAME is needed for error messages. */
 
29
 
 
30
extern void *get_pool_space( pool_t pool, int_t item_count, int_t *index );
 
31
/* Get space for ITEM_COUNT contiguous items in POOL.
 
32
 * Return its address as the function's result. 
 
33
 * Return its index in *INDEX, if INDEX != NULL. */
 
34
 
 
35
extern int_t pool_item_count( pool_t pool );
 
36
/* Return the number of the items in POOL. */
 
37
 
 
38
extern void *pool_item( pool_t pool, int_t index );
 
39
/* Return the address of item with INDEX in pool POOL,
 
40
 * or NULL if there is no such item. */
 
41
 
 
42
extern int_t pool_index( pool_t pool, void *item );
 
43
/* Return the index of ITEM in POOL.
 
44
 * Report an error if ITEM doesn't exist in POOL. */
 
45
 
 
46
extern void *copy_to_pool( pool_t pool, 
 
47
                           void *address,
 
48
                           int_t item_count, 
 
49
                           int_t *index );
 
50
/* Copy the vector *ADDRESS with ITEM_COUNT items into POOL.
 
51
 * The items of *ADDRESS must be of same size as the items in POOL.
 
52
 * Return the address of the copy as the function's result.
 
53
 * Return the index in *INDEX, if INDEX != NULL. */
 
54
 
 
55
extern string_t copy_string_to_pool( pool_t pool, 
 
56
                                     string_t string, 
 
57
                                     int_t *index );
 
58
/* Copy STRING into POOL, which must be a _string_ pool.
 
59
 * Return the copy of the string as the function's result.
 
60
 * Return its index in *INDEX, if INDEX != NULL. */
 
61
 
 
62
/* End of file. =============================================================*/