-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassoc.h
77 lines (51 loc) · 2.11 KB
/
assoc.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef _ASSOC_HEADER
#define _ASSOC_HEADER
/******************************************************************************/
/* */
/* assoc */
/* */
/* a class of associative arrays and Web-oriented functions */
/* */
/* conceived, designed, and implemented by */
/* <a href=http://www.esat.kuleuven.ac.be/~deflorio>[email protected]</a>*/
/* Copyright (c) [email protected]. All rights reserved. */
/* */
/******************************************************************************/
/* the library mimes the fopen() class of functions.
*/
/* The class defines two main types:
*/
typedef struct brick {
struct brick *l, *r, *next;
void *i, *o;
int status;
} brick;
typedef struct {
brick root, *current, *p, *last;
int (*acmp)(const void*,const void*);
} ASSOC;
typedef brick apos_t;
/* A few defines are needed */
#define A_OK 1 /* the couple is not deleted */
#define A_DELETED 2 /* the couple is deleted */
#define A_ALLOC (-1) /* error code from an unsuccessful malloc() */
/* A global variable, aerror, keeps track of the last error */
char aerror[512];
/* max value for the CONTENT_LENGTH environment variable */
#define MAX_CGI_INPUT 4096
/* The functions' prototypes: */
ASSOC *aopen( int (*)(const void*,const void*) );
void aclose(ASSOC*);
int awrite(ASSOC*, void*, void*);
void *aread(ASSOC*, void*);
void *anext(ASSOC*);
void arewind(ASSOC*);
void adel(ASSOC*, void*);
ASSOC *acgi(void);
ASSOC *ascgi(char*);
ASSOC *aargcgi(char**, int);
ASSOC *aenv();
void asave(ASSOC*);
void aload(ASSOC*);
int acmp(const void*, const void*);
#endif