File: alist.h

package info (click to toggle)
ircii-pana 75-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,448 kB
  • ctags: 7,556
  • sloc: ansic: 82,667; makefile: 989; tcl: 153; sh: 124
file content (44 lines) | stat: -rw-r--r-- 1,055 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * alist.h -- resizeable arrays
 * Copyright 1997 EPIC Software Labs
 */

#ifndef __alist_h__
#define __alist_h__

#include "irc.h"

/*
 * Everything that is to be filed with this system should have an
 * identifying name as the first item in the struct.
 */
typedef struct
{
	char *name;
} array_item;

typedef int (*alist_func) (const char *, const char *, size_t);
/*
 * This is the actual list, that contains structs that are of the
 * form described above.  It contains the current size and the maximum
 * size of the array.
 */
typedef struct
{
	array_item **list;
	int max;
	int total_max;
	alist_func func;
} array;

array_item *add_to_array	(array *, array_item *);
array_item *remove_from_array	(array *, char *);
array_item *array_pop		(array *, int);

array_item *remove_all_from_array (array *, char *);
array_item *array_lookup	(array *, char *, int wild, int delete);
array_item *find_array_item	(array *, char *, int *cnt, int *loc);

void *find_fixed_array_item	(void *array, size_t size, int siz, char *, int *cnt, int *loc);

#endif