| 1 |
|
| 2 |
import os |
| 3 |
import sys |
| 4 |
|
| 5 |
MAX_PER_LINE = 100 |
| 6 |
|
| 7 |
def formatCallOrPrototype(content: str, indent: int, lineWidth: int): |
| 8 |
idx = content.find('(') |
| 9 |
shiftStr = ' ' * (idx + 1) |
| 10 |
idx2 = content.find(')', idx+1) |
| 11 |
extraLen = len(content[idx2:]) |
| 12 |
|
| 13 |
ret = [] |
| 14 |
currentLine = content[0:idx+1] |
| 15 |
for arg in content[idx + 1 : idx2].split(','): |
| 16 |
arg = arg.strip() |
| 17 |
|
| 18 |
if indent * 4 + len(currentLine) + len(arg) + extraLen > lineWidth: |
| 19 |
ret.append('\t' * indent + currentLine[0:-1]) |
| 20 |
currentLine = shiftStr |
| 21 |
currentLine += arg + ', ' |
| 22 |
|
| 23 |
if len(currentLine) > len(shiftStr): |
| 24 |
ret.append('\t' * indent + currentLine[0:-2] + content[idx2:]) |
| 25 |
|
| 26 |
return '\n'.join(ret) |
| 27 |
|
| 28 |
def get_values(entry_dict, entry_type): |
| 29 |
values = [] |
| 30 |
if '*' == entry_type: |
| 31 |
for key in list(entry_dict.keys()): |
| 32 |
if entry_type in key: |
| 33 |
values += entry_dict[key] |
| 34 |
entry_dict.pop(key, None) |
| 35 |
elif entry_type in dict(entry_dict): |
| 36 |
values = entry_dict[entry_type] |
| 37 |
entry_dict.pop(entry_type, None) |
| 38 |
if values: |
| 39 |
return sorted(values) |
| 40 |
return values |
| 41 |
|
| 42 |
def get_keys(entry_dict, entry_type, values): |
| 43 |
l = list() |
| 44 |
if '*' == entry_type: |
| 45 |
dval = dict() |
| 46 |
for key in list(entry_dict.keys()): |
| 47 |
if entry_type in key: |
| 48 |
xval = entry_dict[key] |
| 49 |
for val in xval: |
| 50 |
dval[val] = key |
| 51 |
|
| 52 |
for val in list(values): |
| 53 |
key = dval[val] |
| 54 |
l.append(key) |
| 55 |
return l |
| 56 |
|
| 57 |
def write_entry(f, entry_dict, entry_type, entry_name): |
| 58 |
values = get_values(entry_dict, entry_type) |
| 59 |
if not values: |
| 60 |
return |
| 61 |
|
| 62 |
f.write('#define have_' + entry_name.lower() + '_list_indices\n') |
| 63 |
f.write('static const size_t ' + entry_name.lower() + '_list_indices[] = {\n') |
| 64 |
|
| 65 |
for val in values: |
| 66 |
f.write('\tFreeRDP_' + val + ',\n') |
| 67 |
|
| 68 |
f.write('};\n\n') |
| 69 |
|
| 70 |
def formatArrayEntry(content: list[str], ident: int, maxPerLine: int): |
| 71 |
ret = [] |
| 72 |
currentLine = '{ ' |
| 73 |
for arg in content: |
| 74 |
newLen = ident * 4 + len(currentLine) + len(arg) + 2 |
| 75 |
if newLen >= maxPerLine: |
| 76 |
ret.append('\t' * ident + currentLine[0:-1]) |
| 77 |
currentLine = ' ' |
| 78 |
currentLine += arg + ', ' |
| 79 |
|
| 80 |
if len(currentLine) > ident * 4 + 2: |
| 81 |
ret.append('\t' * ident + currentLine[0:-2]) |
| 82 |
|
| 83 |
return "\n".join(ret) + " }" |
| 84 |
|
| 85 |
def write_str_case(f, entry_idx, val): |
| 86 |
entry_types = ['BOOL', 'UINT16', 'INT16', 'UINT32', 'INT32', 'UINT64', 'INT64', 'STRING', 'POINTER'] |
| 87 |
|
| 88 |
f.write(formatArrayEntry([ f'FreeRDP_{val}', f'FREERDP_SETTINGS_TYPE_{entry_types[entry_idx]}', f'"FreeRDP_{val}"'], 1, MAX_PER_LINE) + ',\n') |
| 89 |
|
| 90 |
def write_str(f, entry_dict): |
| 91 |
f.write('typedef enum\n{\n') |
| 92 |
f.write('\tFREERDP_SETTINGS_TYPE_BOOL,\n') |
| 93 |
f.write('\tFREERDP_SETTINGS_TYPE_UINT16,\n') |
| 94 |
f.write('\tFREERDP_SETTINGS_TYPE_INT16,\n') |
| 95 |
f.write('\tFREERDP_SETTINGS_TYPE_UINT32,\n') |
| 96 |
f.write('\tFREERDP_SETTINGS_TYPE_INT32,\n') |
| 97 |
f.write('\tFREERDP_SETTINGS_TYPE_UINT64,\n') |
| 98 |
f.write('\tFREERDP_SETTINGS_TYPE_INT64,\n') |
| 99 |
f.write('\tFREERDP_SETTINGS_TYPE_STRING,\n') |
| 100 |
f.write('\tFREERDP_SETTINGS_TYPE_POINTER\n') |
| 101 |
f.write('} FREERDP_SETTINGS_TYPE;\n') |
| 102 |
f.write('\n') |
| 103 |
f.write('struct settings_str_entry\n{\n') |
| 104 |
f.write('\tSSIZE_T id;\n') |
| 105 |
f.write('\tSSIZE_T type;\n') |
| 106 |
f.write('\tconst char* str;\n') |
| 107 |
f.write('};\n') |
| 108 |
f.write('static const struct settings_str_entry settings_map[] = {\n') |
| 109 |
|
| 110 |
|
| 111 |
entry_types = ['BOOL', 'UINT16', 'INT16', 'UINT32', 'INT32', 'UINT64', 'INT64', 'char*', '*'] |
| 112 |
for entry_type in entry_types: |
| 113 |
values = get_values(entry_dict, entry_type) |
| 114 |
if values: |
| 115 |
for val in values: |
| 116 |
write_str_case(f, entry_types.index(entry_type), val) |
| 117 |
f.write('};\n\n') |
| 118 |
f.write('\n') |
| 119 |
|
| 120 |
def write_getter_case(f, val, cast, typestr): |
| 121 |
f.write('\t\tcase ') |
| 122 |
if typestr: |
| 123 |
f.write('(' + typestr + ')') |
| 124 |
f.write('FreeRDP_' + val + ':\n') |
| 125 |
f.write('\t\t\treturn ' + cast + 'settings->' + val + ';\n\n') |
| 126 |
|
| 127 |
def write_getter_body(f, values, ret, keys, isPointer, compat_values, typestr, entry_type): |
| 128 |
f.write('{\n') |
| 129 |
f.write('\tWINPR_ASSERT(settings);\n\n') |
| 130 |
f.write('\tswitch (id)\n') |
| 131 |
f.write('\t{\n') |
| 132 |
if values: |
| 133 |
for i in range(len(values)): |
| 134 |
val = values[i] |
| 135 |
cast = '' |
| 136 |
if isPointer and keys: |
| 137 |
key = keys[i] |
| 138 |
if key != 'void*': |
| 139 |
cast = '(void*)' |
| 140 |
write_getter_case(f, val, cast, None) |
| 141 |
if compat_values: |
| 142 |
f.write('#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)\n') |
| 143 |
for i in range(len(compat_values)): |
| 144 |
val = compat_values[i] |
| 145 |
cast = '(' + entry_type + ')' |
| 146 |
f.write('\t\t// API Compatibility section, remove with FreeRDP 4.x\n') |
| 147 |
write_getter_case(f, val, cast, typestr) |
| 148 |
f.write('#endif\n') |
| 149 |
f.write('\t\tdefault:\n') |
| 150 |
f.write('\t\t\tWLog_ERR(TAG, "Invalid key index %d [%s|%s]", id, freerdp_settings_get_name_for_key(id),\n\t\t\t freerdp_settings_get_type_name_for_key(id));\n') |
| 151 |
f.write('\t\t\tWINPR_ASSERT(FALSE);\n') |
| 152 |
f.write('\t\t\treturn ' + ret + ';\n') |
| 153 |
f.write('\t}\n') |
| 154 |
f.write('}\n\n') |
| 155 |
|
| 156 |
def write_getter(f, entry_dict, entry_type, entry_name, postfix, compat_dict): |
| 157 |
isString = 'string' in entry_name |
| 158 |
isPointer = 'pointer' in entry_name |
| 159 |
copy = dict(entry_dict) |
| 160 |
values = get_values(entry_dict, entry_type) |
| 161 |
compat_values = get_values(compat_dict, entry_type) |
| 162 |
keys = get_keys(copy, entry_type, values) |
| 163 |
|
| 164 |
typestr = 'FreeRDP_Settings_Keys_' + entry_name.capitalize() |
| 165 |
typestr = typestr.replace('_Uint', '_UInt') |
| 166 |
|
| 167 |
protoLine = '' |
| 168 |
if isPointer: |
| 169 |
protoLine += 'void*' |
| 170 |
elif isString: |
| 171 |
protoLine += 'const ' + entry_type |
| 172 |
else: |
| 173 |
protoLine += entry_type |
| 174 |
|
| 175 |
if isPointer: |
| 176 |
protoLine += ' freerdp_settings_get_pointer_writable(rdpSettings* settings, ' + typestr + ' id)' |
| 177 |
else: |
| 178 |
protoLine += ' freerdp_settings_get_' + entry_name.lower() + '(WINPR_ATTR_UNUSED const rdpSettings* settings, WINPR_ATTR_UNUSED ' + typestr + ' id)' |
| 179 |
f.write(formatCallOrPrototype(protoLine, 0, MAX_PER_LINE) + '\n') |
| 180 |
|
| 181 |
if isString or isPointer: |
| 182 |
ret = 'nullptr'; |
| 183 |
elif 'bool' in entry_name: |
| 184 |
ret = 'FALSE'; |
| 185 |
else: |
| 186 |
ret = '0'; |
| 187 |
|
| 188 |
write_getter_body(f, values, ret, keys, isPointer, compat_values, typestr, entry_type) |
| 189 |
|
| 190 |
if isString: |
| 191 |
f.write('char* freerdp_settings_get_' + entry_name.lower() + '_writable(rdpSettings* settings, ' + typestr + ' id)\n') |
| 192 |
write_getter_body(f, values, ret, keys, isPointer, compat_values, typestr, entry_type) |
| 193 |
|
| 194 |
def write_setter_case(f, val, postfix, isPointer, cast): |
| 195 |
f.write('\t\tcase FreeRDP_' + val + ':\n') |
| 196 |
if isPointer: |
| 197 |
f.write('\t\t\tsettings->' + val + ' = ' + cast + 'cnv.v;\n') |
| 198 |
f.write('\t\t\tbreak;\n\n') |
| 199 |
elif not postfix: |
| 200 |
f.write('\t\t\tsettings->' + val + ' = ' + cast + 'cnv.c;\n') |
| 201 |
f.write('\t\t\tbreak;\n\n') |
| 202 |
elif len(postfix) <= 1: |
| 203 |
f.write(formatCallOrPrototype('return update_string' + postfix + '(&settings->' + val + ', cnv.c, len);\n', 3, MAX_PER_LINE) + '\n') |
| 204 |
else: |
| 205 |
f.write(formatCallOrPrototype('return update_string' + postfix + '(&settings->' + val + ', cnv.cc, len, cleanup);\n', 3, MAX_PER_LINE) + '\n') |
| 206 |
|
| 207 |
def write_setter(f, entry_dict, entry_type, entry_name, postfix, compat_dict): |
| 208 |
isString = 'string' in entry_name |
| 209 |
isPointer = 'pointer' in entry_name |
| 210 |
copy = dict(entry_dict) |
| 211 |
values = get_values(entry_dict, entry_type) |
| 212 |
compat_values = get_values(compat_dict, entry_type) |
| 213 |
keys = get_keys(copy, entry_type, values) |
| 214 |
|
| 215 |
typestr = 'FreeRDP_Settings_Keys_' + entry_name.capitalize() |
| 216 |
typestr = typestr.replace('_Uint', '_UInt') |
| 217 |
|
| 218 |
protoLine = 'BOOL freerdp_settings_set_' + entry_name.lower() + postfix + '(WINPR_ATTR_UNUSED rdpSettings* settings, WINPR_ATTR_UNUSED ' + typestr + ' id, ' |
| 219 |
if isString or isPointer: |
| 220 |
protoLine += 'const ' |
| 221 |
if not isPointer: |
| 222 |
protoLine += entry_type + ' val' |
| 223 |
else: |
| 224 |
protoLine += 'void* val' |
| 225 |
|
| 226 |
if isString and len(postfix) <= 1: |
| 227 |
protoLine += ', size_t len)\n' |
| 228 |
elif isString: |
| 229 |
protoLine += ', size_t len, BOOL cleanup)' |
| 230 |
else: |
| 231 |
protoLine += ')' |
| 232 |
f.write(formatCallOrPrototype(protoLine, 0, MAX_PER_LINE) + '\n') |
| 233 |
|
| 234 |
f.write('{\n') |
| 235 |
f.write('\tunion\n') |
| 236 |
f.write('\t{\n') |
| 237 |
f.write('\t\tvoid* v;\n') |
| 238 |
f.write('\t\tconst void* cv;\n') |
| 239 |
if not isPointer: |
| 240 |
f.write('\t\t' + entry_type + ' c;\n') |
| 241 |
f.write('\t\tconst ' + entry_type + ' cc;\n') |
| 242 |
f.write('\t} cnv;\n') |
| 243 |
|
| 244 |
f.write('\tWINPR_ASSERT(settings);\n\n') |
| 245 |
if isPointer: |
| 246 |
f.write('\tcnv.cv = val;\n\n') |
| 247 |
elif isString: |
| 248 |
f.write('\tcnv.cc = val;\n\n') |
| 249 |
else: |
| 250 |
f.write('\tcnv.c = val;\n\n') |
| 251 |
f.write('\tswitch (id)\n') |
| 252 |
f.write('\t{\n') |
| 253 |
if values: |
| 254 |
count = 0 |
| 255 |
for val in values: |
| 256 |
index = count |
| 257 |
count += 1 |
| 258 |
cast = '' |
| 259 |
if isPointer: |
| 260 |
k = keys[index]; |
| 261 |
if k != 'void*' and len(k) > 0: |
| 262 |
cast = '(' + k + ')' |
| 263 |
write_setter_case(f, val, postfix, isPointer, cast) |
| 264 |
if compat_values: |
| 265 |
f.write('#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)\n') |
| 266 |
for val in compat_values: |
| 267 |
cast = '(int32_t)' |
| 268 |
f.write('\t\t// API Compatibility section, remove with FreeRDP 4.x\n') |
| 269 |
write_setter_case(f, val, postfix, isPointer, cast) |
| 270 |
f.write('#endif\n') |
| 271 |
f.write('\t\tdefault:\n') |
| 272 |
f.write('\t\t\tWLog_ERR(TAG, "Invalid key index %d [%s|%s]", id, freerdp_settings_get_name_for_key(id),\n\t\t\t freerdp_settings_get_type_name_for_key(id));\n') |
| 273 |
f.write('\t\t\treturn FALSE;\n') |
| 274 |
f.write('\t}\n') |
| 275 |
f.write('\treturn TRUE;\n') |
| 276 |
f.write('}\n') |
| 277 |
f.write('\n') |
| 278 |
if isString and len(postfix) <= 1: |
| 279 |
f.write('BOOL freerdp_settings_set_string_len(rdpSettings* settings, FreeRDP_Settings_Keys_String id,\n') |
| 280 |
f.write(' const char* val, size_t len)\n') |
| 281 |
f.write('{\n') |
| 282 |
f.write('\treturn freerdp_settings_set_string_copy_(settings, id, val, len, TRUE);\n') |
| 283 |
f.write('}\n') |
| 284 |
f.write('\n') |
| 285 |
|
| 286 |
f.write('BOOL freerdp_settings_set_string(rdpSettings* settings, FreeRDP_Settings_Keys_String id,\n') |
| 287 |
f.write(' const char* val)\n') |
| 288 |
f.write('{\n') |
| 289 |
f.write('\tsize_t len = 0;\n') |
| 290 |
f.write('\tif (val)\n') |
| 291 |
f.write('\t\tlen = strlen(val);\n') |
| 292 |
f.write('\treturn freerdp_settings_set_string_copy_(settings, id, val, len, TRUE);\n') |
| 293 |
f.write('}\n') |
| 294 |
f.write('\n') |
| 295 |
|
| 296 |
name = os.path.dirname(os.path.realpath(__file__)) |
| 297 |
begin = "WARNING: this data structure is carefully padded for ABI stability!" |
| 298 |
end = "WARNING: End of ABI stable zone!" |
| 299 |
|
| 300 |
print('begin parsing settings header') |
| 301 |
try: |
| 302 |
type_list = dict() |
| 303 |
|
| 304 |
with open(name + "/../include/freerdp/settings_types_private.h", "r") as f: |
| 305 |
lines = f.readlines() |
| 306 |
started = False |
| 307 |
for line in lines: |
| 308 |
if not started: |
| 309 |
if begin in line: |
| 310 |
started = True |
| 311 |
continue |
| 312 |
|
| 313 |
if end in line: |
| 314 |
break |
| 315 |
|
| 316 |
sline = line.strip() |
| 317 |
if not sline: |
| 318 |
continue |
| 319 |
if sline.startswith('/'): |
| 320 |
continue |
| 321 |
if sline.startswith('*'): |
| 322 |
continue |
| 323 |
if 'padding' in sline: |
| 324 |
continue |
| 325 |
if 'version' in sline: |
| 326 |
continue |
| 327 |
|
| 328 |
if sline.startswith('SETTINGS_DEPRECATED(ALIGN64'): |
| 329 |
sline = sline[27:].strip() |
| 330 |
|
| 331 |
sline = sline[:sline.find(');')] |
| 332 |
pair = sline.split() |
| 333 |
if pair[0] in type_list: |
| 334 |
type_list[pair[0]].append(pair[1]) |
| 335 |
else: |
| 336 |
type_list[pair[0]] = [pair[1]] |
| 337 |
|
| 338 |
with open(name + '/../libfreerdp/common/settings_getters.c', 'w+') as f: |
| 339 |
f.write('/* Generated by ' + '' + ' */\n\n') |
| 340 |
f.write('#define FREERDP_SETTINGS_INTERNAL_USE\n\n') |
| 341 |
f.write('#include <freerdp/settings_types_private.h>\n\n') |
| 342 |
f.write('\n\n') |
| 343 |
f.write('#include "../core/settings.h"\n\n') |
| 344 |
f.write('#include <winpr/assert.h>\n') |
| 345 |
f.write('#include <freerdp/settings.h>\n') |
| 346 |
f.write('#include <freerdp/log.h>\n\n') |
| 347 |
f.write('#define TAG FREERDP_TAG("common.settings")\n\n') |
| 348 |
|
| 349 |
f.write('static void free_string(char** current, BOOL cleanup)\n') |
| 350 |
f.write('{\n') |
| 351 |
f.write('\tif (cleanup)\n') |
| 352 |
f.write('\t{\n') |
| 353 |
f.write('\t\tif (*current)\n') |
| 354 |
f.write('\t\t\tmemset(*current, 0, strlen(*current));\n') |
| 355 |
f.write('\t\tfree(*current);\n') |
| 356 |
f.write('\t\t(*current) = nullptr;\n') |
| 357 |
f.write('\t}\n') |
| 358 |
f.write('}\n\n') |
| 359 |
|
| 360 |
f.write('static BOOL alloc_empty_string(char** current, const char* next, size_t next_len)\n') |
| 361 |
f.write('{\n') |
| 362 |
f.write('\tif (!next && (next_len > 0))\n') |
| 363 |
f.write('\t{\n') |
| 364 |
f.write('\t\t*current = calloc(next_len, 1);\n') |
| 365 |
f.write('\t\treturn (*current != nullptr);\n') |
| 366 |
f.write('\t}\n') |
| 367 |
f.write('\treturn FALSE;\n') |
| 368 |
f.write('}\n\n') |
| 369 |
|
| 370 |
|
| 371 |
f.write('static BOOL update_string_copy_(char** current, const char* next, size_t next_len, BOOL cleanup)\n') |
| 372 |
f.write('{\n') |
| 373 |
f.write('\tfree_string(current, cleanup);\n') |
| 374 |
f.write('\n') |
| 375 |
f.write('\tif (alloc_empty_string(current, next, next_len))\n') |
| 376 |
f.write('\t\treturn TRUE;\n') |
| 377 |
f.write('\n') |
| 378 |
f.write('\t*current = (next ? strndup(next, next_len) : nullptr);\n') |
| 379 |
f.write('\treturn !next || (*current != nullptr);\n') |
| 380 |
f.write('}\n\n') |
| 381 |
|
| 382 |
f.write('static BOOL update_string_(char** current, char* next, size_t next_len)\n') |
| 383 |
f.write('{\n') |
| 384 |
f.write('\tfree_string(current, TRUE);\n') |
| 385 |
f.write('\n') |
| 386 |
f.write('\tif (alloc_empty_string(current, next, next_len))\n') |
| 387 |
f.write('\t\treturn TRUE;\n') |
| 388 |
f.write('\n') |
| 389 |
f.write('\t*current = next;\n') |
| 390 |
f.write('\treturn !next || (*current != nullptr);\n') |
| 391 |
f.write('}\n\n') |
| 392 |
|
| 393 |
getter_list = dict(type_list) |
| 394 |
setter_list = dict(type_list) |
| 395 |
setter_list2 = dict(type_list) |
| 396 |
|
| 397 |
compat_getter_list = dict() |
| 398 |
compat_getter_list['UINT32'] = list() |
| 399 |
compat_getter_list['UINT32'].append('MonitorLocalShiftX') |
| 400 |
compat_getter_list['UINT32'].append('MonitorLocalShiftY') |
| 401 |
|
| 402 |
compat_setter_list = dict(compat_getter_list) |
| 403 |
|
| 404 |
write_getter(f, getter_list, 'BOOL', 'bool', '', compat_getter_list) |
| 405 |
write_setter(f, setter_list, 'BOOL', 'bool', '', compat_setter_list) |
| 406 |
write_getter(f, getter_list, 'UINT16', 'uint16', '', compat_getter_list) |
| 407 |
write_setter(f, setter_list, 'UINT16', 'uint16', '', compat_setter_list) |
| 408 |
write_getter(f, getter_list, 'INT16', 'int16', '', compat_getter_list) |
| 409 |
write_setter(f, setter_list, 'INT16', 'int16', '', compat_setter_list) |
| 410 |
write_getter(f, getter_list, 'UINT32', 'uint32', '', compat_getter_list) |
| 411 |
write_setter(f, setter_list, 'UINT32', 'uint32', '', compat_setter_list) |
| 412 |
write_getter(f, getter_list, 'INT32', 'int32', '', compat_getter_list) |
| 413 |
write_setter(f, setter_list, 'INT32', 'int32', '', compat_setter_list) |
| 414 |
write_getter(f, getter_list, 'UINT64', 'uint64', '', compat_getter_list) |
| 415 |
write_setter(f, setter_list, 'UINT64', 'uint64', '', compat_setter_list) |
| 416 |
write_getter(f, getter_list, 'INT64', 'int64', '', compat_getter_list) |
| 417 |
write_setter(f, setter_list, 'INT64', 'int64', '', compat_setter_list) |
| 418 |
write_getter(f, getter_list, 'char*', 'string', '_', compat_getter_list) |
| 419 |
write_setter(f, setter_list, 'char*', 'string', '_', compat_setter_list) |
| 420 |
write_setter(f, setter_list2, 'char*', 'string', '_copy_', compat_setter_list) |
| 421 |
write_getter(f, getter_list, '*', 'pointer', '', compat_getter_list) |
| 422 |
write_setter(f, setter_list, '*', 'pointer', '', compat_setter_list) |
| 423 |
|
| 424 |
f.write('\n') |
| 425 |
|
| 426 |
with open(name + '/../libfreerdp/common/settings_str.h', 'w+') as f: |
| 427 |
f.write('/* Generated by ' + '' + ' */\n\n') |
| 428 |
f.write('#ifndef FREERDP_CORE_SETTINGS_STR_H\n') |
| 429 |
f.write('#define FREERDP_CORE_SETTINGS_STR_H\n\n') |
| 430 |
f.write('#include "../core/settings.h"\n\n') |
| 431 |
f.write('#include <freerdp/settings.h>\n') |
| 432 |
f.write('#include <freerdp/log.h>\n\n') |
| 433 |
f.write('#define TAG FREERDP_TAG("common.settings")\n\n') |
| 434 |
|
| 435 |
getter_list = dict(type_list) |
| 436 |
write_str(f, getter_list) |
| 437 |
f.write('#endif\n') |
| 438 |
f.write('\n') |
| 439 |
|
| 440 |
|
| 441 |
with open(name + '/../libfreerdp/core/test/settings_property_lists.h', 'w+') as f: |
| 442 |
f.write('#ifndef TEST_SETTINGS_PROPERTY_LISTS\n') |
| 443 |
f.write('#define TEST_SETTINGS_PROPERTY_LISTS\n\n') |
| 444 |
|
| 445 |
write_entry(f, type_list, 'BOOL', 'bool') |
| 446 |
write_entry(f, type_list, 'UINT16', 'uint16') |
| 447 |
write_entry(f, type_list, 'INT16', 'int16') |
| 448 |
write_entry(f, type_list, 'UINT32', 'uint32') |
| 449 |
write_entry(f, type_list, 'INT32', 'int32') |
| 450 |
write_entry(f, type_list, 'UINT64', 'uint64') |
| 451 |
write_entry(f, type_list, 'INT64', 'int64') |
| 452 |
write_entry(f, type_list, 'char*', 'string') |
| 453 |
write_entry(f, type_list, '*', 'pointer') |
| 454 |
|
| 455 |
f.write('#endif /* TEST_SETTINGS_PROPERTY_LISTS */\n\n') |
| 456 |
|
| 457 |
print('remaining:\n' + str(type_list)) |
| 458 |
except IOError as e: |
| 459 |
print('failed to parse settings header ' + str(e)) |
| 460 |
sys.exit(-1) |
| 461 |
print('ended parsing settings header') |