cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Go to the documentation of this file.
1 /*
2  Copyright 2019 AS
4  This file is part of CFEngine 3 - written and maintained by AS.
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  GNU General Public License for more details.
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
28 #include <cf3.defs.h>
29 #include <writer.h>
30 #include <json.h>
31 #include <fncall.h>
33 /* NOTE: an empty Rlist is simply NULL. */
34 struct Rlist_
35 {
38 };
42 bool RlistValueIsType(const Rlist *rlist, RvalType type);
43 char *RvalScalarValue(Rval rval);
48 const char *RvalTypeToString(RvalType type);
50 Rval RvalNew(const void *item, RvalType type);
51 Rval RvalNewRewriter(const void *item, RvalType type, JsonElement *map);
52 Rval RvalCopy(Rval rval);
54 void RvalDestroy(Rval rval);
56 char *RvalToString(Rval rval);
57 char *RlistToString(const Rlist *rlist);
58 void RvalWrite(Writer *writer, Rval rval);
59 void RvalWriteQuoted(Writer *writer, Rval rval);
60 unsigned RvalHash(Rval rval, unsigned seed);
62 Rlist *RlistCopy(const Rlist *list);
63 Rlist *RlistCopyRewriter(const Rlist *list, JsonElement *map);
64 unsigned int RlistHash (const Rlist *list, unsigned seed);
65 unsigned int RlistHash_untyped(const void *list, unsigned seed);
66 void RlistDestroy (Rlist *list);
67 void RlistDestroy_untyped(void *rl);
68 void RlistDestroyEntry(Rlist **liststart, Rlist *entry);
69 char *RlistScalarValue(const Rlist *rlist);
70 char *RlistScalarValueSafe(const Rlist *rlist);
71 FnCall *RlistFnCallValue(const Rlist *rlist);
72 Rlist *RlistRlistValue(const Rlist *rlist);
73 Rlist *RlistParseShown(const char *string);
74 Rlist *RlistParseString(const char *string);
75 Rlist *RlistKeyIn(Rlist *list, const char *key);
76 int RlistLen(const Rlist *start);
77 bool RlistMatchesRegexRlist(const Rlist *list, const Rlist *search);
78 bool RlistMatchesRegex(const Rlist *list, const char *str);
79 bool RlistIsInListOfRegex(const Rlist *list, const char *str);
80 bool RlistIsNullList(const Rlist *list);
81 bool RlistContainsString(const Rlist *list, const char *string);
83 Rlist *RlistAppendRval(Rlist **start, Rval rval);
85 Rlist *RlistPrependScalarIdemp(Rlist **start, const char *scalar);
86 Rlist *RlistAppendScalarIdemp(Rlist **start, const char *scalar);
87 Rlist *RlistAppendScalar(Rlist **start, const char *scalar);
89 Rlist *RlistPrepend(Rlist **start, const void *item, RvalType type);
90 Rlist *RlistAppend(Rlist **start, const void *item, RvalType type);
91 Rlist *RlistAppendAllTypes(Rlist **start, const void *item, RvalType type, bool all_types);
92 Rlist *RlistAppendString(Rlist **start, const char *string);
94 Rlist *RlistFromSplitString(const char *string, char sep);
95 Rlist *RlistFromStringSplitLines(const char *string, bool detect_crlf);
96 Rlist *RlistFromSplitRegex(const char *string, const char *regex, size_t max_entries, bool allow_blanks);
97 Rlist *RlistFromRegexSplitNoOverflow(const char *string, const char *regex, int max);
98 Rlist *RlistFromContainer(const JsonElement *container);
100 void RlistWrite(Writer *writer, const Rlist *list);
101 Rlist *RlistLast(Rlist *start);
102 void RlistFilter(Rlist **list, bool (*KeepPredicate)(void *item, void *predicate_data), void *predicate_user_data, void (*DestroyItem)(void *item));
103 void RlistReverse(Rlist **list);
104 void ScalarWrite(Writer *w, const char *s, bool quote);
105 void RlistFlatten(EvalContext *ctx, Rlist **list);
106 bool RlistEqual (const Rlist *list1, const Rlist *list2);
107 bool RlistEqual_untyped(const void *list1, const void *list2);
110 #endif
Definition: cf3.defs.h:605
Definition: cf3.defs.h:368
Rlist * RlistAppendAllTypes(Rlist **start, const void *item, RvalType type, bool all_types)
Definition: rlist.c:566
bool RlistEqual(const Rlist *list1, const Rlist *list2)
Definition: rlist.c:1599
void RvalWriteQuoted(Writer *writer, Rval rval)
Definition: rlist.c:1391
void RlistFilter(Rlist **list, bool(*KeepPredicate)(void *item, void *predicate_data), void *predicate_user_data, void(*DestroyItem)(void *item))
FnCall * RlistFnCallValue(const Rlist *rlist)
Definition: rlist.c:105
Rlist * RlistRlistValue(const Rlist *rlist)
Definition: rlist.c:117
Rlist * RlistAppendRval(Rlist **start, Rval rval)
Definition: rlist.c:321
JsonElement * RvalContainerValue(Rval rval)
Definition: rlist.c:165
Rval RvalCopyRewriter(Rval rval, JsonElement *map)
Definition: rlist.c:469
char * RlistScalarValue(const Rlist *rlist)
Definition: rlist.c:83
unsigned int RlistHash_untyped(const void *list, unsigned seed)
Definition: rlist.c:1438
Rlist * RvalRlistValue(Rval rval)
Definition: rlist.c:153
Rlist * RlistFromRegexSplitNoOverflow(const char *string, const char *regex, int max)
Definition: rlist.c:1205
void RvalWrite(Writer *writer, Rval rval)
Definition: rlist.c:1386
FnCall * RvalFnCallValue(Rval rval)
Definition: rlist.c:141
char * RvalScalarValue(Rval rval)
Definition: rlist.c:129
unsigned RvalHash(Rval rval, unsigned seed)
Definition: rlist.c:1410
Rlist * RlistParseShown(const char *string)
Definition: rlist.c:686
char * RlistScalarValueSafe(const Rlist *rlist)
Definition: rlist.c:93
void RlistWrite(Writer *writer, const Rlist *list)
Definition: rlist.c:1318
Rlist * RlistAppend(Rlist **start, const void *item, RvalType type)
Definition: rlist.c:560
bool RlistMatchesRegexRlist(const Rlist *list, const Rlist *search)
Definition: rlist.c:212
Rlist * RlistParseString(const char *string)
Definition: rlist.c:927
void RlistDestroy_untyped(void *rl)
Definition: rlist.c:518
Rlist * RlistFromSplitRegex(const char *string, const char *regex, size_t max_entries, bool allow_blanks)
Definition: rlist.c:1139
Rlist * RlistPrepend(Rlist **start, const void *item, RvalType type)
Definition: rlist.c:645
void ScalarWrite(Writer *w, const char *s, bool quote)
Definition: rlist.c:1335
Rlist * RlistKeyIn(Rlist *list, const char *key)
Definition: rlist.c:196
JsonElement * RvalToJson(Rval rval)
Definition: rlist.c:1506
void RlistDestroyEntry(Rlist **liststart, Rlist *entry)
Definition: rlist.c:972
char * RvalToString(Rval rval)
Definition: rlist.c:1396
Rlist * RlistFromContainer(const JsonElement *container)
Definition: rlist.c:1691
Rlist * RlistFromStringSplitLines(const char *string, bool detect_crlf)
Definition: rlist.c:1105
bool RlistEqual_untyped(const void *list1, const void *list2)
Definition: rlist.c:1652
Rlist * RlistFromSplitString(const char *string, char sep)
Definition: rlist.c:1067
RvalType DataTypeToRvalType(DataType datatype)
Definition: rlist.c:44
void RvalDestroy(Rval rval)
Definition: rlist.c:940
bool RlistMatchesRegex(const Rlist *list, const char *str)
Definition: rlist.c:231
Rval RvalNew(const void *item, RvalType type)
Definition: rlist.c:464
Rlist * RlistCopy(const Rlist *list)
Definition: rlist.c:494
Rlist * RlistAppendScalar(Rlist **start, const char *scalar)
Definition: rlist.c:545
Rlist * RlistCopyRewriter(const Rlist *list, JsonElement *map)
Definition: rlist.c:481
unsigned int RlistHash(const Rlist *list, unsigned seed)
Definition: rlist.c:1428
const char * RvalTypeToString(RvalType type)
Definition: rlist.c:176
Rlist * RlistAppendScalarIdemp(Rlist **start, const char *scalar)
Definition: rlist.c:525
int RlistLen(const Rlist *start)
Definition: rlist.c:672
bool RlistIsNullList(const Rlist *list)
Definition: rlist.c:262
Rlist * RlistAppendString(Rlist **start, const char *string)
Definition: rlist.c:550
void RlistReverse(Rlist **list)
Definition: rlist.c:1305
void RlistDestroy(Rlist *list)
Definition: rlist.c:501
bool RlistContainsString(const Rlist *list, const char *string)
Definition: rlist.c:290
Rlist * RlistPrependScalarIdemp(Rlist **start, const char *scalar)
Definition: rlist.c:535
char * RlistToString(const Rlist *rlist)
Definition: rlist.c:1403
Rlist * RlistLast(Rlist *start)
Definition: rlist.c:1253
void RlistFlatten(EvalContext *ctx, Rlist **list)
Flattens an Rlist by expanding naked scalar list-variable members. Flattening is only one-level deep.
Definition: rlist.c:1534
bool RlistValueIsType(const Rlist *rlist, RvalType type)
Definition: rlist.c:77
Rval RvalNewRewriter(const void *item, RvalType type, JsonElement *map)
Definition: rlist.c:357
Rval RvalCopy(Rval rval)
Definition: rlist.c:474
bool RlistIsInListOfRegex(const Rlist *list, const char *str)
Definition: rlist.c:267
Definition: fncall.h:31
Definition: rlist.h:35
Rval val
Definition: rlist.h:36
Rlist * next
Definition: rlist.h:37
Definition: cf3.defs.h:614
Definition: writer.c:45