~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to st.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
2
 
 
3
 
/* @(#) st.h 5.1 89/12/14 */
4
 
 
5
 
#ifndef ST_INCLUDED
6
 
 
7
 
#define ST_INCLUDED
8
 
 
9
 
#if SIZEOF_LONG == SIZEOF_VOIDP
10
 
typedef unsigned long st_data_t;
11
 
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
12
 
typedef unsigned LONG_LONG st_data_t;
13
 
#else
14
 
# error ---->> st.c requires sizeof(void*) == sizeof(long) to be compiled. <<---
15
 
-
16
 
#endif
17
 
#define ST_DATA_T_DEFINED
18
 
 
19
 
typedef struct st_table st_table;
20
 
 
21
 
struct st_hash_type {
22
 
    int (*compare)();
23
 
    int (*hash)();
24
 
};
25
 
 
26
 
struct st_table {
27
 
    struct st_hash_type *type;
28
 
    int num_bins;
29
 
    int num_entries;
30
 
    struct st_table_entry **bins;
31
 
};
32
 
 
33
 
#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
34
 
 
35
 
enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
36
 
 
37
 
#ifndef _
38
 
# define _(args) args
39
 
#endif
40
 
#ifndef ANYARGS
41
 
# ifdef __cplusplus
42
 
#   define ANYARGS ...
43
 
# else
44
 
#   define ANYARGS
45
 
# endif
46
 
#endif
47
 
 
48
 
st_table *st_init_table(struct st_hash_type *);
49
 
st_table *st_init_table_with_size(struct st_hash_type *, int);
50
 
st_table *st_init_numtable(void);
51
 
st_table *st_init_numtable_with_size(int);
52
 
st_table *st_init_strtable(void);
53
 
st_table *st_init_strtable_with_size(int);
54
 
int st_delete(st_table *, st_data_t *, st_data_t *);
55
 
int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t);
56
 
int st_insert(st_table *, st_data_t, st_data_t);
57
 
int st_lookup(st_table *, st_data_t, st_data_t *);
58
 
int st_foreach(st_table *, int (*)(ANYARGS), st_data_t);
59
 
void st_add_direct(st_table *, st_data_t, st_data_t);
60
 
void st_free_table(st_table *);
61
 
void st_cleanup_safe(st_table *, st_data_t);
62
 
st_table *st_copy(st_table *);
63
 
int st_numcmp(long, long);
64
 
int st_numhash(long);
65
 
 
66
 
#endif /* ST_INCLUDED */