summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2019-10-15 16:52:30 +0200
committerStefan Metzmacher <metze@samba.org>2019-11-27 10:25:32 +0000
commitef1f0e9ffe76eaee4b92241ea39d81ea553fa841 (patch)
treeec81dec9a4a95fd58a1d1bca7aba651bdfe32fa3 /script
parent3215d357e6af97ac05266b6ab5c8861d7f124815 (diff)
downloadsamba-ef1f0e9ffe76eaee4b92241ea39d81ea553fa841.tar.gz
param: add FN_{GLOBAL,LOCAL}_SUBSTITUTED_STRING support
Pair-Programmed-With: Ralph Boehme <slow@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'script')
-rw-r--r--script/generate_param.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/script/generate_param.py b/script/generate_param.py
index 5f8a50562d4..55f2b65271b 100644
--- a/script/generate_param.py
+++ b/script/generate_param.py
@@ -75,6 +75,7 @@ def iterate_all(path):
continue
constant = parameter.attrib.get("constant")
+ substitution = parameter.attrib.get("substitution")
parm = parameter.attrib.get("parm")
if name is None or param_type is None or context is None:
raise Exception("Error parsing parameter: " + name)
@@ -89,6 +90,7 @@ def iterate_all(path):
'context': context,
'function': func,
'constant': (constant == '1'),
+ 'substitution': (substitution == '1'),
'parm': (parm == '1'),
'synonym' : synonym,
'generated' : generated,
@@ -135,6 +137,8 @@ def generate_functions(path_in, path_out):
output_string += temp
if parameter['constant']:
output_string += "_CONST"
+ if parameter['substitution']:
+ output_string += "_SUBSTITUTED"
if parameter['parm']:
output_string += "_PARM"
temp = param_type_dict.get(parameter['type'])
@@ -192,7 +196,14 @@ def make_s3_param_proto(path_in, path_out):
else:
param = "int"
- if parameter['type'] == 'string' and not parameter['constant']:
+ if parameter['type'] == 'string' and parameter['substitution']:
+ if parameter['context'] == 'G':
+ output_string += '(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub);\n'
+ elif parameter['context'] == 'S':
+ output_string += '(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub, %s);\n' % param
+ else:
+ raise Exception(parameter['name'] + " has an invalid param type " + parameter['type'])
+ elif parameter['type'] == 'string' and not parameter['constant']:
if parameter['context'] == 'G':
output_string += '(TALLOC_CTX *ctx);\n'
elif parameter['context'] == 'S':
@@ -237,7 +248,14 @@ def make_lib_proto(path_in, path_out):
output_string += "lpcfg_%s" % parameter['function']
- if parameter['type'] == 'string' and not parameter['constant']:
+ if parameter['type'] == 'string' and parameter['substitution']:
+ if parameter['context'] == 'G':
+ output_string += '(struct loadparm_context *, const struct loadparm_substitution *lp_sub, TALLOC_CTX *ctx);\n'
+ elif parameter['context'] == 'S':
+ output_string += '(struct loadparm_service *, struct loadparm_service *, TALLOC_CTX *ctx);\n'
+ else:
+ raise Exception(parameter['name'] + " has an invalid context " + parameter['context'])
+ elif parameter['type'] == 'string' and not parameter['constant']:
if parameter['context'] == 'G':
output_string += '(struct loadparm_context *, TALLOC_CTX *ctx);\n'
elif parameter['context'] == 'S':