]> git.ipfire.org Git - thirdparty/bash.git/blame - assoc.h
Bash-5.2 patch 26: fix typo when specifying readline's custom color prefix
[thirdparty/bash.git] / assoc.h
CommitLineData
3185942a
JA
1/* assoc.h -- definitions for the interface exported by assoc.c that allows
2 the rest of the shell to manipulate associative array variables. */
3
74091dd4 4/* Copyright (C) 2008,2009-2021 Free Software Foundation, Inc.
3185942a
JA
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#ifndef _ASSOC_H_
23#define _ASSOC_H_
24
25#include "stdc.h"
26#include "hashlib.h"
27
8868edaf
CR
28#define ASSOC_HASH_BUCKETS 1024
29
3185942a
JA
30#define assoc_empty(h) ((h)->nentries == 0)
31#define assoc_num_elements(h) ((h)->nentries)
32
33#define assoc_create(n) (hash_create((n)))
34
35#define assoc_copy(h) (hash_copy((h), 0))
36
37#define assoc_walk(h, f) (hash_walk((h), (f))
38
8868edaf
CR
39extern void assoc_dispose PARAMS((HASH_TABLE *));
40extern void assoc_flush PARAMS((HASH_TABLE *));
3185942a 41
8868edaf
CR
42extern int assoc_insert PARAMS((HASH_TABLE *, char *, char *));
43extern PTR_T assoc_replace PARAMS((HASH_TABLE *, char *, char *));
44extern void assoc_remove PARAMS((HASH_TABLE *, char *));
3185942a 45
8868edaf 46extern char *assoc_reference PARAMS((HASH_TABLE *, char *));
3185942a 47
8868edaf
CR
48extern char *assoc_subrange PARAMS((HASH_TABLE *, arrayind_t, arrayind_t, int, int, int));
49extern char *assoc_patsub PARAMS((HASH_TABLE *, char *, char *, int));
50extern char *assoc_modcase PARAMS((HASH_TABLE *, char *, int, int));
3185942a 51
8868edaf
CR
52extern HASH_TABLE *assoc_quote PARAMS((HASH_TABLE *));
53extern HASH_TABLE *assoc_quote_escapes PARAMS((HASH_TABLE *));
54extern HASH_TABLE *assoc_dequote PARAMS((HASH_TABLE *));
55extern HASH_TABLE *assoc_dequote_escapes PARAMS((HASH_TABLE *));
56extern HASH_TABLE *assoc_remove_quoted_nulls PARAMS((HASH_TABLE *));
3185942a 57
8868edaf
CR
58extern char *assoc_to_kvpair PARAMS((HASH_TABLE *, int));
59extern char *assoc_to_assign PARAMS((HASH_TABLE *, int));
3185942a 60
8868edaf
CR
61extern WORD_LIST *assoc_to_word_list PARAMS((HASH_TABLE *));
62extern WORD_LIST *assoc_keys_to_word_list PARAMS((HASH_TABLE *));
74091dd4 63extern WORD_LIST *assoc_to_kvpair_list PARAMS((HASH_TABLE *));
3185942a 64
8868edaf 65extern char *assoc_to_string PARAMS((HASH_TABLE *, char *, int));
3185942a 66#endif /* _ASSOC_H_ */