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)  

scope.h
Go to the documentation of this file.
1 /*
2  Copyright 2019 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
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.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
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
18 
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 */
24 
25 #ifndef CFENGINE_SCOPE_H
26 #define CFENGINE_SCOPE_H
27 
28 #include <cf3.defs.h>
29 
30 #include <var_expressions.h>
31 
32 typedef enum
33 {
42 
45 
46 const char *SpecialScopeToString(SpecialScope scope);
47 SpecialScope SpecialScopeFromString(const char *scope);
48 
49 /**
50  * @brief augments a scope, expecting corresponding lists of lvals and rvals (implying same length).
51  * in addition to copying them in, also attempts to do one-pass resolution of variables,
52  * and evaluates function calls, and attempts expansion on senior scope members.
53  */
54 void ScopeAugment(EvalContext *ctx, const Bundle *bp, const Promise *pp, const Rlist *arguments);
55 
56 void ScopeMapBodyArgs(EvalContext *ctx, const Body *body, const Rlist *args);
57 
58 // TODO: namespacing utility functions. there are probably a lot of these floating around, but probably best
59 // leave them until we get a proper symbol table
60 void JoinScopeName(const char *ns, const char *bundle, char scope_out[CF_MAXVARSIZE]);
61 
62 #endif
#define CF_MAXVARSIZE
Definition: definitions.h:36
SpecialScope
Definition: scope.h:33
@ SPECIAL_SCOPE_THIS
Definition: scope.h:39
@ SPECIAL_SCOPE_EDIT
Definition: scope.h:35
@ SPECIAL_SCOPE_MON
Definition: scope.h:37
@ SPECIAL_SCOPE_SYS
Definition: scope.h:38
@ SPECIAL_SCOPE_CONST
Definition: scope.h:34
@ SPECIAL_SCOPE_MATCH
Definition: scope.h:36
@ SPECIAL_SCOPE_BODY
Definition: scope.h:40
@ SPECIAL_SCOPE_DEF
Definition: scope.h:41
@ SPECIAL_SCOPE_NONE
Definition: scope.h:43
const char * SpecialScopeToString(SpecialScope scope)
Definition: scope.c:42
SpecialScope SpecialScopeFromString(const char *scope)
Definition: scope.c:67
void ScopeMapBodyArgs(EvalContext *ctx, const Body *body, const Rlist *args)
Definition: scope.c:238
void JoinScopeName(const char *ns, const char *bundle, char scope_out[1024])
Definition: scope.c:333
void ScopeAugment(EvalContext *ctx, const Bundle *bp, const Promise *pp, const Rlist *arguments)
augments a scope, expecting corresponding lists of lvals and rvals (implying same length)....
Definition: scope.c:111
Definition: policy.h:85
Definition: policy.h:70
Definition: rlist.h:35