summaryrefslogtreecommitdiff
path: root/fonts/utilities/mff-29/assoc.h
blob: 128919dec70d139a7194c55783dc498bd1f7a8ea (plain)
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
/* assoc.h 2.9.0 92/07/06 - simple association list
 *  Created - Damian Cugley <pdc@oxford.prg> Fri 12 Jan 1990
 */

#include "stdc.h"

typedef struct assoc_node 
{
  struct assoc_node *next;
  char *s;
} *Assoclist;

const char *assoc ARGS((Assoclist al, const char *s));
 /* return the value associated with s, or (char*)0 if there is none. */

Assoclist assoc_destroylist ARGS((Assoclist));

Assoclist assoc_add ARGS((Assoclist al, char *s));
   /*  
    *  s is a malloc'd string of the form "KEY=VAL"
    */

const char *assoc_match_backwards ARGS((Assoclist al, const char *s,
					const char **pe));
/*
 *  Try to find a KEY=VAL in al such that KEY is a suffix
 *  of  the string from s to just before *pe.
 *
 *  Returns VAL, if found,  otherwise (char *)0.
 *
 *  If ne is non-NULL, then *pe is set to (*pe - length(KEY)),
 *  i.e., the start of the matching suffix ( s <= *pe < *pe0 ).
 *
 *  If no match is found, then returns (char *)0, and *pe is unchanged.
 */


void	assoc_print ARGS((Assoclist));
				/* Print a list (for debugging purposes) */