1 /*
2   ***** BEGIN LICENSE BLOCK *****
3 
4   Copyright (C) 2001-2020 Olof Hagsand
5 
6   This file is part of CLIgen.
7 
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11 
12     http://www.apache.org/licenses/LICENSE-2.0
13 
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19 
20   Alternatively, the contents of this file may be used under the terms of
21   the GNU General Public License Version 2 or later (the "GPL"),
22   in which case the provisions of the GPL are applicable instead
23   of those above. If you wish to allow use of your version of this file only
24   under the terms of the GPL, and not to allow others to
25   use your version of this file under the terms of Apache License version 2, indicate
26   your decision by deleting the provisions above and replace them with the
27   notice and other provisions required by the GPL. If you do not delete
28   the provisions above, a recipient may use your version of this file under
29   the terms of any one of the Apache License version 2 or the GPL.
30 
31   ***** END LICENSE BLOCK *****
32 
33 
34   CLIgen variable vectors - cvec
35 */
36 
37 #ifndef _CLIGEN_CVEC_H_
38 #define _CLIGEN_CVEC_H_
39 
40 /*
41  * CLIgen variable record that encapsulates parsed variable vectors, etc.
42  * Never use these fields directly.
43  * Defined internally in cligen_cvec.c
44  */
45 typedef struct cvec cvec;
46 
47 
48 /*
49  * Prototypes
50  */
51 cvec   *cvec_new(int len);
52 cvec   *cvec_from_var(cg_var *cv);
53 int     cvec_free(cvec *vr);
54 int     cvec_init(cvec *vr, int len);
55 int     cvec_reset(cvec *vr);
56 int     cvec_len(cvec *vr);
57 cg_var *cvec_i(cvec *vr, int i);
58 char   *cvec_i_str(cvec *cvv, int i);
59 cg_var *cvec_next(cvec *vr, cg_var *cv0);
60 cg_var *cvec_add(cvec *vr, enum cv_type type);
61 cg_var *cvec_append_var(cvec *cvv, cg_var *var);
62 int     cvec_del(cvec *vr, cg_var *del);
63 int     cvec_del_i(cvec *vr, int ix);
64 cg_var *cvec_each(cvec *vr, cg_var *prev);
65 cg_var *cvec_each1(cvec *vr, cg_var *prev);
66 cvec   *cvec_dup(cvec *old);
67 cvec   *cvec_start(char *cmd);
68 int     cvec_print(FILE *f, cvec *vr);
69 int     cvec2cbuf(cbuf *cb, cvec *cvv);
70 cg_var *cvec_find(cvec *vr, char *name);
71 cg_var *cvec_find_keyword(cvec *vr, char *name);
72 cg_var *cvec_find_var(cvec *vr, char *name);
73 char   *cvec_find_str(cvec *vr, char *name);
74 char   *cvec_name_get(cvec *vr);
75 char   *cvec_name_set(cvec *vr, char *name);
76 int     cv_exclude_keys(int status);
77 int     cv_exclude_keys_get(void);
78 size_t  cvec_size(cvec *cvv);
79 
80 #endif /* _CLIGEN_CVEC_H_ */
81 
82