~ubuntu-branches/ubuntu/trusty/malaga/trusty-proposed

« back to all changes in this revision

Viewing changes to source/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
 
/* This file is part of Malaga, a system for Natural Language Analysis.
2
 
 * Copyright (C) 1995-1999 Bjoern Beutel
3
 
 *
4
 
 * Bjoern Beutel
5
 
 * Universitaet Erlangen-Nuernberg
6
 
 * Abteilung fuer Computerlinguistik
7
 
 * Bismarckstrasse 12
8
 
 * D-91054 Erlangen
9
 
 * e-mail: malaga@linguistik.uni-erlangen.de 
10
 
 *
11
 
 * This program is free software; you can redistribute it and/or modify
12
 
 * it under the terms of the GNU General Public License as published by
13
 
 * the Free Software Foundation; either version 2 of the License, or
14
 
 * (at your option) any later version.
15
 
 *
16
 
 * This program is distributed in the hope that it will be useful,
17
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
 * GNU General Public License for more details.
20
 
 *
21
 
 * You should have received a copy of the GNU General Public License
22
 
 * along with this program; if not, write to the Free Software
23
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
24
 
 
25
 
/* description ==============================================================*/
26
 
 
27
 
/* This module defines a new data type, "pool_t", for growing vectors of items 
28
 
 * of an arbitrary type. */
29
 
 
30
 
/* types ====================================================================*/
31
 
 
32
 
/* the abstract data type <pool_t> */
33
 
typedef struct POOL_T *pool_t;
34
 
 
35
 
/* functions ================================================================*/
36
 
 
37
 
extern pool_t new_pool (int_t item_size);
38
 
/* Create a new pool that records items of size <item_size>. */
39
 
 
40
 
extern void free_pool (pool_t *pool);
41
 
/* Free all memory used by <*pool>. */
42
 
 
43
 
extern void clear_pool (pool_t pool);
44
 
/* Clear <pool> (do not free any memory used by the pool). */
45
 
 
46
 
extern void *pool_to_vector (pool_t pool);
47
 
/* Return <pool> as a C vector (contiguous memory).
48
 
 * The vector can be freed with "free" after use. */
49
 
 
50
 
extern void write_pool (pool_t pool, FILE *stream, string_t file_name);
51
 
/* Write <pool> to <stream> (<file_name> is needed for error messages). */
52
 
 
53
 
extern void *get_pool_space (pool_t pool, int_t num_items, int_t *index);
54
 
/* Get space for <num_items> contiguous items in pool <pool>,
55
 
 * return its address as the function's result and the index in *<index>,
56
 
 * if <index> != NULL. */
57
 
 
58
 
extern int_t pool_items (pool_t pool);
59
 
/* Return the number of the items in <pool>. */
60
 
 
61
 
extern void *pool_item (pool_t pool, int_t index);
62
 
/* Return the address of item with <index> in pool <pool>,
63
 
 * or NULL if there is no such item. */
64
 
 
65
 
extern int_t pool_index (pool_t pool, void *item);
66
 
/* Return the index of <item> in <pool>.
67
 
 * Report an error if <item> doesn't exist in <pool>. */
68
 
 
69
 
extern void *copy_to_pool (pool_t pool, 
70
 
                           void *ptr, 
71
 
                           int_t num_items, 
72
 
                           int_t *index);
73
 
/* Copy the vector *<ptr> of length <num_items> into <pool>.
74
 
 * The items of *<ptr> must be of same size as the items in <pool>.
75
 
 * Return the address of the copy as the function's result and the
76
 
 * index in *<index>, if <index> != NULL. */
77
 
 
78
 
extern string_t copy_string_to_pool (pool_t pool, 
79
 
                                     string_t string, 
80
 
                                     int_t *index);
81
 
/* Copy the string <string> into <pool>, which must be a string pool.
82
 
 * Return the copy of the string as the function's result as well as
83
 
 * its index in *<index>, if <index> != NULL. */
84
 
 
85
 
/* end of file ==============================================================*/