Lines 12-17
Link Here
|
12 |
# Documents produced by Doxygen are derivative works derived from the |
12 |
# Documents produced by Doxygen are derivative works derived from the |
13 |
# input used in their production; they are not affected by this license. |
13 |
# input used in their production; they are not affected by this license. |
14 |
# |
14 |
# |
|
|
15 |
|
16 |
from __future__ import print_function |
17 |
|
15 |
import xml.dom.minidom |
18 |
import xml.dom.minidom |
16 |
import sys |
19 |
import sys |
17 |
import re |
20 |
import re |
Lines 112-118
Link Here
|
112 |
if (n.nodeName == "value"): |
115 |
if (n.nodeName == "value"): |
113 |
if n.nodeType == Node.ELEMENT_NODE: |
116 |
if n.nodeType == Node.ELEMENT_NODE: |
114 |
name = n.getAttribute('name') |
117 |
name = n.getAttribute('name') |
115 |
print " %s->addValue(\"%s\");" % (var, name) |
118 |
print(" %s->addValue(\"%s\");" % (var, name)) |
116 |
|
119 |
|
117 |
|
120 |
|
118 |
def parseHeader(node,objName): |
121 |
def parseHeader(node,objName): |
Lines 123-137
Link Here
|
123 |
if (n.getAttribute('doxyfile') != "0"): |
126 |
if (n.getAttribute('doxyfile') != "0"): |
124 |
doc += parseDocs(n) |
127 |
doc += parseDocs(n) |
125 |
docC = transformDocs(doc) |
128 |
docC = transformDocs(doc) |
126 |
print " %s->setHeader(" % (objName) |
129 |
print(" %s->setHeader(" % (objName)) |
127 |
rng = len(docC) |
130 |
rng = len(docC) |
128 |
for i in range(rng): |
131 |
for i in range(rng): |
129 |
line = docC[i] |
132 |
line = docC[i] |
130 |
if i != rng - 1: # since we go from 0 to rng-1 |
133 |
if i != rng - 1: # since we go from 0 to rng-1 |
131 |
print " \"%s\\n\"" % (line) |
134 |
print(" \"%s\\n\"" % (line)) |
132 |
else: |
135 |
else: |
133 |
print " \"%s\"" % (line) |
136 |
print(" \"%s\"" % (line)) |
134 |
print " );" |
137 |
print(" );") |
135 |
|
138 |
|
136 |
|
139 |
|
137 |
def prepCDocs(node): |
140 |
def prepCDocs(node): |
Lines 225-232
Link Here
|
225 |
setting = node.getAttribute('setting') |
228 |
setting = node.getAttribute('setting') |
226 |
docC = prepCDocs(node); |
229 |
docC = prepCDocs(node); |
227 |
if len(setting) > 0: |
230 |
if len(setting) > 0: |
228 |
print "#if %s" % (setting) |
231 |
print("#if %s" % (setting)) |
229 |
print " //----" |
232 |
print(" //----") |
230 |
if type == 'bool': |
233 |
if type == 'bool': |
231 |
if len(adefval) > 0: |
234 |
if len(adefval) > 0: |
232 |
enabled = adefval |
235 |
enabled = adefval |
Lines 234-339
Link Here
|
234 |
enabled = "TRUE" |
237 |
enabled = "TRUE" |
235 |
else: |
238 |
else: |
236 |
enabled = "FALSE" |
239 |
enabled = "FALSE" |
237 |
print " cb = cfg->addBool(" |
240 |
print(" cb = cfg->addBool(") |
238 |
print " \"%s\"," % (name) |
241 |
print(" \"%s\"," % (name)) |
239 |
rng = len(docC) |
242 |
rng = len(docC) |
240 |
for i in range(rng): |
243 |
for i in range(rng): |
241 |
line = docC[i] |
244 |
line = docC[i] |
242 |
if i != rng - 1: # since we go from 0 to rng-1 |
245 |
if i != rng - 1: # since we go from 0 to rng-1 |
243 |
print " \"%s\\n\"" % (line) |
246 |
print(" \"%s\\n\"" % (line)) |
244 |
else: |
247 |
else: |
245 |
print " \"%s\"," % (line) |
248 |
print(" \"%s\"," % (line)) |
246 |
print " %s" % (enabled) |
249 |
print(" %s" % (enabled)) |
247 |
print " );" |
250 |
print(" );") |
248 |
if depends != '': |
251 |
if depends != '': |
249 |
print " cb->addDependency(\"%s\");" % (depends) |
252 |
print(" cb->addDependency(\"%s\");" % (depends)) |
250 |
elif type == 'string': |
253 |
elif type == 'string': |
251 |
print " cs = cfg->addString(" |
254 |
print(" cs = cfg->addString(") |
252 |
print " \"%s\"," % (name) |
255 |
print(" \"%s\"," % (name)) |
253 |
rng = len(docC) |
256 |
rng = len(docC) |
254 |
for i in range(rng): |
257 |
for i in range(rng): |
255 |
line = docC[i] |
258 |
line = docC[i] |
256 |
if i != rng - 1: # since we go from 0 to rng-1 |
259 |
if i != rng - 1: # since we go from 0 to rng-1 |
257 |
print " \"%s\\n\"" % (line) |
260 |
print(" \"%s\\n\"" % (line)) |
258 |
else: |
261 |
else: |
259 |
print " \"%s\"" % (line) |
262 |
print(" \"%s\"" % (line)) |
260 |
print " );" |
263 |
print(" );") |
261 |
if defval != '': |
264 |
if defval != '': |
262 |
print " cs->setDefaultValue(\"%s\");" % (defval) |
265 |
print(" cs->setDefaultValue(\"%s\");" % (defval)) |
263 |
if format == 'file': |
266 |
if format == 'file': |
264 |
print " cs->setWidgetType(ConfigString::File);" |
267 |
print(" cs->setWidgetType(ConfigString::File);") |
265 |
elif format == 'dir': |
268 |
elif format == 'dir': |
266 |
print " cs->setWidgetType(ConfigString::Dir);" |
269 |
print(" cs->setWidgetType(ConfigString::Dir);") |
267 |
if depends != '': |
270 |
if depends != '': |
268 |
print " cs->addDependency(\"%s\");" % (depends) |
271 |
print(" cs->addDependency(\"%s\");" % (depends)) |
269 |
elif type == 'enum': |
272 |
elif type == 'enum': |
270 |
print " ce = cfg->addEnum(" |
273 |
print(" ce = cfg->addEnum(") |
271 |
print " \"%s\"," % (name) |
274 |
print(" \"%s\"," % (name)) |
272 |
rng = len(docC) |
275 |
rng = len(docC) |
273 |
for i in range(rng): |
276 |
for i in range(rng): |
274 |
line = docC[i] |
277 |
line = docC[i] |
275 |
if i != rng - 1: # since we go from 0 to rng-1 |
278 |
if i != rng - 1: # since we go from 0 to rng-1 |
276 |
print " \"%s\\n\"" % (line) |
279 |
print(" \"%s\\n\"" % (line)) |
277 |
else: |
280 |
else: |
278 |
print " \"%s\"," % (line) |
281 |
print(" \"%s\"," % (line)) |
279 |
print " \"%s\"" % (defval) |
282 |
print(" \"%s\"" % (defval)) |
280 |
print " );" |
283 |
print(" );") |
281 |
addValues("ce", node) |
284 |
addValues("ce", node) |
282 |
if depends != '': |
285 |
if depends != '': |
283 |
print " ce->addDependency(\"%s\");" % (depends) |
286 |
print(" ce->addDependency(\"%s\");" % (depends)) |
284 |
elif type == 'int': |
287 |
elif type == 'int': |
285 |
minval = node.getAttribute('minval') |
288 |
minval = node.getAttribute('minval') |
286 |
maxval = node.getAttribute('maxval') |
289 |
maxval = node.getAttribute('maxval') |
287 |
print " ci = cfg->addInt(" |
290 |
print(" ci = cfg->addInt(") |
288 |
print " \"%s\"," % (name) |
291 |
print(" \"%s\"," % (name)) |
289 |
rng = len(docC) |
292 |
rng = len(docC) |
290 |
for i in range(rng): |
293 |
for i in range(rng): |
291 |
line = docC[i] |
294 |
line = docC[i] |
292 |
if i != rng - 1: # since we go from 0 to rng-1 |
295 |
if i != rng - 1: # since we go from 0 to rng-1 |
293 |
print " \"%s\\n\"" % (line) |
296 |
print(" \"%s\\n\"" % (line)) |
294 |
else: |
297 |
else: |
295 |
print " \"%s\"," % (line) |
298 |
print(" \"%s\"," % (line)) |
296 |
print " %s,%s,%s" % (minval, maxval, defval) |
299 |
print(" %s,%s,%s" % (minval, maxval, defval)) |
297 |
print " );" |
300 |
print(" );") |
298 |
if depends != '': |
301 |
if depends != '': |
299 |
print " ci->addDependency(\"%s\");" % (depends) |
302 |
print(" ci->addDependency(\"%s\");" % (depends)) |
300 |
elif type == 'list': |
303 |
elif type == 'list': |
301 |
print " cl = cfg->addList(" |
304 |
print(" cl = cfg->addList(") |
302 |
print " \"%s\"," % (name) |
305 |
print(" \"%s\"," % (name)) |
303 |
rng = len(docC) |
306 |
rng = len(docC) |
304 |
for i in range(rng): |
307 |
for i in range(rng): |
305 |
line = docC[i] |
308 |
line = docC[i] |
306 |
if i != rng - 1: # since we go from 0 to rng-1 |
309 |
if i != rng - 1: # since we go from 0 to rng-1 |
307 |
print " \"%s\\n\"" % (line) |
310 |
print(" \"%s\\n\"" % (line)) |
308 |
else: |
311 |
else: |
309 |
print " \"%s\"" % (line) |
312 |
print(" \"%s\"" % (line)) |
310 |
print " );" |
313 |
print(" );") |
311 |
addValues("cl", node) |
314 |
addValues("cl", node) |
312 |
if depends != '': |
315 |
if depends != '': |
313 |
print " cl->addDependency(\"%s\");" % (depends) |
316 |
print(" cl->addDependency(\"%s\");" % (depends)) |
314 |
if format == 'file': |
317 |
if format == 'file': |
315 |
print " cl->setWidgetType(ConfigList::File);" |
318 |
print(" cl->setWidgetType(ConfigList::File);") |
316 |
elif format == 'dir': |
319 |
elif format == 'dir': |
317 |
print " cl->setWidgetType(ConfigList::Dir);" |
320 |
print(" cl->setWidgetType(ConfigList::Dir);") |
318 |
elif format == 'filedir': |
321 |
elif format == 'filedir': |
319 |
print " cl->setWidgetType(ConfigList::FileAndDir);" |
322 |
print(" cl->setWidgetType(ConfigList::FileAndDir);") |
320 |
elif type == 'obsolete': |
323 |
elif type == 'obsolete': |
321 |
print " cfg->addObsolete(\"%s\");" % (name) |
324 |
print(" cfg->addObsolete(\"%s\");" % (name)) |
322 |
if len(setting) > 0: |
325 |
if len(setting) > 0: |
323 |
print "#else" |
326 |
print("#else") |
324 |
print " cfg->addDisabled(\"%s\");" % (name) |
327 |
print(" cfg->addDisabled(\"%s\");" % (name)) |
325 |
print "#endif" |
328 |
print("#endif") |
326 |
|
329 |
|
327 |
|
330 |
|
328 |
def parseGroups(node): |
331 |
def parseGroups(node): |
329 |
name = node.getAttribute('name') |
332 |
name = node.getAttribute('name') |
330 |
doc = node.getAttribute('docs') |
333 |
doc = node.getAttribute('docs') |
331 |
print "%s%s" % (" //-----------------------------------------", |
334 |
print("%s%s" % (" //-----------------------------------------", |
332 |
"----------------------------------") |
335 |
"----------------------------------")) |
333 |
print " cfg->addInfo(\"%s\",\"%s\");" % (name, doc) |
336 |
print(" cfg->addInfo(\"%s\",\"%s\");" % (name, doc)) |
334 |
print "%s%s" % (" //-----------------------------------------", |
337 |
print("%s%s" % (" //-----------------------------------------", |
335 |
"----------------------------------") |
338 |
"----------------------------------")) |
336 |
print |
339 |
print() |
337 |
for n in node.childNodes: |
340 |
for n in node.childNodes: |
338 |
if n.nodeType == Node.ELEMENT_NODE: |
341 |
if n.nodeType == Node.ELEMENT_NODE: |
339 |
parseOption(n) |
342 |
parseOption(n) |
Lines 345-360
Link Here
|
345 |
name = n.getAttribute('id') |
348 |
name = n.getAttribute('id') |
346 |
docC = prepCDocs(n); |
349 |
docC = prepCDocs(n); |
347 |
if type != 'obsolete': |
350 |
if type != 'obsolete': |
348 |
print " doc->add(" |
351 |
print(" doc->add(") |
349 |
print " \"%s\"," % (name) |
352 |
print(" \"%s\"," % (name)) |
350 |
rng = len(docC) |
353 |
rng = len(docC) |
351 |
for i in range(rng): |
354 |
for i in range(rng): |
352 |
line = docC[i] |
355 |
line = docC[i] |
353 |
if i != rng - 1: # since we go from 0 to rng-1 |
356 |
if i != rng - 1: # since we go from 0 to rng-1 |
354 |
print " \"%s\\n\"" % (line) |
357 |
print(" \"%s\\n\"" % (line)) |
355 |
else: |
358 |
else: |
356 |
print " \"%s\"" % (line) |
359 |
print(" \"%s\"" % (line)) |
357 |
print " );" |
360 |
print(" );") |
358 |
|
361 |
|
359 |
def parseOptionDoc(node, first): |
362 |
def parseOptionDoc(node, first): |
360 |
# Handling part for documentation |
363 |
# Handling part for documentation |
Lines 373-424
Link Here
|
373 |
if n.nodeType == Node.ELEMENT_NODE: |
376 |
if n.nodeType == Node.ELEMENT_NODE: |
374 |
doc += parseDocs(n) |
377 |
doc += parseDocs(n) |
375 |
if (first): |
378 |
if (first): |
376 |
print " \\anchor cfg_%s" % (name.lower()) |
379 |
print(" \\anchor cfg_%s" % (name.lower())) |
377 |
print "<dl>" |
380 |
print("<dl>") |
378 |
print "" |
381 |
print("") |
379 |
print "<dt>\\c %s <dd>" % (name) |
382 |
print("<dt>\\c %s <dd>" % (name)) |
380 |
else: |
383 |
else: |
381 |
print " \\anchor cfg_%s" % (name.lower()) |
384 |
print(" \\anchor cfg_%s" % (name.lower())) |
382 |
print "<dt>\\c %s <dd>" % (name) |
385 |
print("<dt>\\c %s <dd>" % (name)) |
383 |
print " \\addindex %s" % (name) |
386 |
print(" \\addindex %s" % (name)) |
384 |
print doc |
387 |
print(doc) |
385 |
if (type == 'enum'): |
388 |
if (type == 'enum'): |
386 |
values = collectValues(node) |
389 |
values = collectValues(node) |
387 |
print "" |
390 |
print("") |
388 |
print "Possible values are: " |
391 |
print("Possible values are: ") |
389 |
rng = len(values) |
392 |
rng = len(values) |
390 |
for i in range(rng): |
393 |
for i in range(rng): |
391 |
val = values[i] |
394 |
val = values[i] |
392 |
if i == rng - 2: |
395 |
if i == rng - 2: |
393 |
print "%s and " % (val) |
396 |
print("%s and " % (val)) |
394 |
elif i == rng - 1: |
397 |
elif i == rng - 1: |
395 |
print "%s." % (val) |
398 |
print("%s." % (val)) |
396 |
else: |
399 |
else: |
397 |
print "%s, " % (val) |
400 |
print("%s, " % (val)) |
398 |
if (defval != ""): |
401 |
if (defval != ""): |
399 |
print "" |
402 |
print("") |
400 |
print "" |
403 |
print("") |
401 |
print "The default value is: <code>%s</code>." % (defval) |
404 |
print("The default value is: <code>%s</code>." % (defval)) |
402 |
print "" |
405 |
print("") |
403 |
elif (type == 'int'): |
406 |
elif (type == 'int'): |
404 |
minval = node.getAttribute('minval') |
407 |
minval = node.getAttribute('minval') |
405 |
maxval = node.getAttribute('maxval') |
408 |
maxval = node.getAttribute('maxval') |
406 |
print "" |
409 |
print("") |
407 |
print "" |
410 |
print("") |
408 |
print "%s: %s%s%s, %s: %s%s%s, %s: %s%s%s." % ( |
411 |
print("%s: %s%s%s, %s: %s%s%s, %s: %s%s%s." % ( |
409 |
" Minimum value", "<code>", minval, "</code>", |
412 |
" Minimum value", "<code>", minval, "</code>", |
410 |
"maximum value", "<code>", maxval, "</code>", |
413 |
"maximum value", "<code>", maxval, "</code>", |
411 |
"default value", "<code>", defval, "</code>") |
414 |
"default value", "<code>", defval, "</code>")) |
412 |
print "" |
415 |
print("") |
413 |
elif (type == 'bool'): |
416 |
elif (type == 'bool'): |
414 |
print "" |
417 |
print("") |
415 |
print "" |
418 |
print("") |
416 |
if (node.hasAttribute('altdefval')): |
419 |
if (node.hasAttribute('altdefval')): |
417 |
print "The default value is: system dependent." |
420 |
print("The default value is: system dependent.") |
418 |
else: |
421 |
else: |
419 |
print "The default value is: <code>%s</code>." % ( |
422 |
print("The default value is: <code>%s</code>." % ( |
420 |
"YES" if (defval == "1") else "NO") |
423 |
"YES" if (defval == "1") else "NO")) |
421 |
print "" |
424 |
print("") |
422 |
elif (type == 'list'): |
425 |
elif (type == 'list'): |
423 |
if format == 'string': |
426 |
if format == 'string': |
424 |
values = collectValues(node) |
427 |
values = collectValues(node) |
Lines 426-487
Link Here
|
426 |
for i in range(rng): |
429 |
for i in range(rng): |
427 |
val = values[i] |
430 |
val = values[i] |
428 |
if i == rng - 2: |
431 |
if i == rng - 2: |
429 |
print "%s and " % (val) |
432 |
print("%s and " % (val)) |
430 |
elif i == rng - 1: |
433 |
elif i == rng - 1: |
431 |
print "%s." % (val) |
434 |
print("%s." % (val)) |
432 |
else: |
435 |
else: |
433 |
print "%s, " % (val) |
436 |
print("%s, " % (val)) |
434 |
print "" |
437 |
print("") |
435 |
elif (type == 'string'): |
438 |
elif (type == 'string'): |
436 |
if format == 'dir': |
439 |
if format == 'dir': |
437 |
if defval != '': |
440 |
if defval != '': |
438 |
print "" |
441 |
print("") |
439 |
print "The default directory is: <code>%s</code>." % ( |
442 |
print("The default directory is: <code>%s</code>." % ( |
440 |
defval) |
443 |
defval)) |
441 |
elif format == 'file': |
444 |
elif format == 'file': |
442 |
abspath = node.getAttribute('abspath') |
445 |
abspath = node.getAttribute('abspath') |
443 |
if defval != '': |
446 |
if defval != '': |
444 |
print "" |
447 |
print("") |
445 |
if abspath != '1': |
448 |
if abspath != '1': |
446 |
print "The default file is: <code>%s</code>." % ( |
449 |
print("The default file is: <code>%s</code>." % ( |
447 |
defval) |
450 |
defval)) |
448 |
else: |
451 |
else: |
449 |
print "%s: %s%s%s." % ( |
452 |
print("%s: %s%s%s." % ( |
450 |
"The default file (with absolute path) is", |
453 |
"The default file (with absolute path) is", |
451 |
"<code>",defval,"</code>") |
454 |
"<code>",defval,"</code>")) |
452 |
else: |
455 |
else: |
453 |
if abspath == '1': |
456 |
if abspath == '1': |
454 |
print "" |
457 |
print("") |
455 |
print "The file has to be specified with full path." |
458 |
print("The file has to be specified with full path.") |
456 |
else: # format == 'string': |
459 |
else: # format == 'string': |
457 |
if defval != '': |
460 |
if defval != '': |
458 |
print "" |
461 |
print("") |
459 |
print "The default value is: <code>%s</code>." % ( |
462 |
print("The default value is: <code>%s</code>." % ( |
460 |
defval) |
463 |
defval)) |
461 |
print "" |
464 |
print("") |
462 |
# depends handling |
465 |
# depends handling |
463 |
if (node.hasAttribute('depends')): |
466 |
if (node.hasAttribute('depends')): |
464 |
depends = node.getAttribute('depends') |
467 |
depends = node.getAttribute('depends') |
465 |
print "" |
468 |
print("") |
466 |
print "%s \\ref cfg_%s \"%s\" is set to \\c YES." % ( |
469 |
print("%s \\ref cfg_%s \"%s\" is set to \\c YES." % ( |
467 |
"This tag requires that the tag", depends.lower(), depends.upper()) |
470 |
"This tag requires that the tag", depends.lower(), depends.upper())) |
468 |
return False |
471 |
return False |
469 |
|
472 |
|
470 |
|
473 |
|
471 |
def parseGroupsDoc(node): |
474 |
def parseGroupsDoc(node): |
472 |
name = node.getAttribute('name') |
475 |
name = node.getAttribute('name') |
473 |
doc = node.getAttribute('docs') |
476 |
doc = node.getAttribute('docs') |
474 |
print "\section config_%s %s" % (name.lower(), doc) |
477 |
print("\section config_%s %s" % (name.lower(), doc)) |
475 |
# Start of list has been moved to the first option for better |
478 |
# Start of list has been moved to the first option for better |
476 |
# anchor placement |
479 |
# anchor placement |
477 |
# print "<dl>" |
480 |
# print("<dl>") |
478 |
# print "" |
481 |
# print("") |
479 |
first = True |
482 |
first = True |
480 |
for n in node.childNodes: |
483 |
for n in node.childNodes: |
481 |
if n.nodeType == Node.ELEMENT_NODE: |
484 |
if n.nodeType == Node.ELEMENT_NODE: |
482 |
first = parseOptionDoc(n, first) |
485 |
first = parseOptionDoc(n, first) |
483 |
if (not first): |
486 |
if (not first): |
484 |
print "</dl>" |
487 |
print("</dl>") |
485 |
|
488 |
|
486 |
|
489 |
|
487 |
def parseGroupsList(node, commandsList): |
490 |
def parseGroupsList(node, commandsList): |
Lines 512-518
Link Here
|
512 |
if (n.nodeName == "docs"): |
515 |
if (n.nodeName == "docs"): |
513 |
if (n.getAttribute('documentation') != "0"): |
516 |
if (n.getAttribute('documentation') != "0"): |
514 |
doc += parseDocs(n) |
517 |
doc += parseDocs(n) |
515 |
print doc |
518 |
print(doc) |
516 |
|
519 |
|
517 |
|
520 |
|
518 |
def parseFooterDoc(node): |
521 |
def parseFooterDoc(node): |
Lines 522-528
Link Here
|
522 |
if (n.nodeName == "docs"): |
525 |
if (n.nodeName == "docs"): |
523 |
if (n.getAttribute('documentation') != "0"): |
526 |
if (n.getAttribute('documentation') != "0"): |
524 |
doc += parseDocs(n) |
527 |
doc += parseDocs(n) |
525 |
print doc |
528 |
print(doc) |
526 |
|
529 |
|
527 |
|
530 |
|
528 |
def main(): |
531 |
def main(): |
Lines 531-546
Link Here
|
531 |
try: |
534 |
try: |
532 |
doc = xml.dom.minidom.parse(sys.argv[2]) |
535 |
doc = xml.dom.minidom.parse(sys.argv[2]) |
533 |
except Exception as inst: |
536 |
except Exception as inst: |
534 |
print >> sys.stderr |
537 |
print("\n%s\n" % inst, file=sys.stderr) |
535 |
print >> sys.stderr, inst |
|
|
536 |
print >> sys.stderr |
537 |
sys.exit(1) |
538 |
sys.exit(1) |
538 |
elem = doc.documentElement |
539 |
elem = doc.documentElement |
539 |
if (sys.argv[1] == "-doc"): |
540 |
if (sys.argv[1] == "-doc"): |
540 |
print "/* WARNING: This file is generated!" |
541 |
print("/* WARNING: This file is generated!") |
541 |
print " * Do not edit this file, but edit config.xml instead and run" |
542 |
print(" * Do not edit this file, but edit config.xml instead and run") |
542 |
print " * python configgen.py -doc config.xml to regenerate this file!" |
543 |
print(" * python configgen.py -doc config.xml to regenerate this file!") |
543 |
print " */" |
544 |
print(" */") |
544 |
# process header |
545 |
# process header |
545 |
for n in elem.childNodes: |
546 |
for n in elem.childNodes: |
546 |
if n.nodeType == Node.ELEMENT_NODE: |
547 |
if n.nodeType == Node.ELEMENT_NODE: |
Lines 552-561
Link Here
|
552 |
if n.nodeType == Node.ELEMENT_NODE: |
553 |
if n.nodeType == Node.ELEMENT_NODE: |
553 |
if (n.nodeName == "group"): |
554 |
if (n.nodeName == "group"): |
554 |
commandsList = parseGroupsList(n, commandsList) |
555 |
commandsList = parseGroupsList(n, commandsList) |
555 |
print "\\secreflist" |
556 |
print("\\secreflist") |
556 |
for x in sorted(commandsList): |
557 |
for x in sorted(commandsList): |
557 |
print "\\refitem cfg_%s %s" % (x.lower(), x) |
558 |
print("\\refitem cfg_%s %s" % (x.lower(), x)) |
558 |
print "\\endsecreflist" |
559 |
print("\\endsecreflist") |
559 |
# process groups and options |
560 |
# process groups and options |
560 |
for n in elem.childNodes: |
561 |
for n in elem.childNodes: |
561 |
if n.nodeType == Node.ELEMENT_NODE: |
562 |
if n.nodeType == Node.ELEMENT_NODE: |
Lines 567-590
Link Here
|
567 |
if (n.nodeName == "footer"): |
568 |
if (n.nodeName == "footer"): |
568 |
parseFooterDoc(n) |
569 |
parseFooterDoc(n) |
569 |
elif (sys.argv[1] == "-cpp"): |
570 |
elif (sys.argv[1] == "-cpp"): |
570 |
print "/* WARNING: This file is generated!" |
571 |
print("/* WARNING: This file is generated!") |
571 |
print " * Do not edit this file, but edit config.xml instead and run" |
572 |
print(" * Do not edit this file, but edit config.xml instead and run") |
572 |
print " * python configgen.py -cpp config.xml to regenerate this file!" |
573 |
print(" * python configgen.py -cpp config.xml to regenerate this file!") |
573 |
print " */" |
574 |
print(" */") |
574 |
print "" |
575 |
print("") |
575 |
print "#include \"configoptions.h\"" |
576 |
print("#include \"configoptions.h\"") |
576 |
print "#include \"config.h\"" |
577 |
print("#include \"config.h\"") |
577 |
print "#include \"portable.h\"" |
578 |
print("#include \"portable.h\"") |
578 |
print "#include \"settings.h\"" |
579 |
print("#include \"settings.h\"") |
579 |
print "" |
580 |
print("") |
580 |
print "void addConfigOptions(Config *cfg)" |
581 |
print("void addConfigOptions(Config *cfg)") |
581 |
print "{" |
582 |
print("{") |
582 |
print " ConfigString *cs;" |
583 |
print(" ConfigString *cs;") |
583 |
print " ConfigEnum *ce;" |
584 |
print(" ConfigEnum *ce;") |
584 |
print " ConfigList *cl;" |
585 |
print(" ConfigList *cl;") |
585 |
print " ConfigInt *ci;" |
586 |
print(" ConfigInt *ci;") |
586 |
print " ConfigBool *cb;" |
587 |
print(" ConfigBool *cb;") |
587 |
print "" |
588 |
print("") |
588 |
# process header |
589 |
# process header |
589 |
for n in elem.childNodes: |
590 |
for n in elem.childNodes: |
590 |
if n.nodeType == Node.ELEMENT_NODE: |
591 |
if n.nodeType == Node.ELEMENT_NODE: |
Lines 594-610
Link Here
|
594 |
if n.nodeType == Node.ELEMENT_NODE: |
595 |
if n.nodeType == Node.ELEMENT_NODE: |
595 |
if (n.nodeName == "group"): |
596 |
if (n.nodeName == "group"): |
596 |
parseGroups(n) |
597 |
parseGroups(n) |
597 |
print "}" |
598 |
print("}") |
598 |
elif (sys.argv[1] == "-wiz"): |
599 |
elif (sys.argv[1] == "-wiz"): |
599 |
print "/* WARNING: This file is generated!" |
600 |
print("/* WARNING: This file is generated!") |
600 |
print " * Do not edit this file, but edit config.xml instead and run" |
601 |
print(" * Do not edit this file, but edit config.xml instead and run") |
601 |
print " * python configgen.py -wiz config.xml to regenerate this file!" |
602 |
print(" * python configgen.py -wiz config.xml to regenerate this file!") |
602 |
print " */" |
603 |
print(" */") |
603 |
print "#include \"configdoc.h\"" |
604 |
print("#include \"configdoc.h\"") |
604 |
print "#include \"docintf.h\"" |
605 |
print("#include \"docintf.h\"") |
605 |
print "" |
606 |
print("") |
606 |
print "void addConfigDocs(DocIntf *doc)" |
607 |
print("void addConfigDocs(DocIntf *doc)") |
607 |
print "{" |
608 |
print("{") |
608 |
for n in elem.childNodes: |
609 |
for n in elem.childNodes: |
609 |
if n.nodeType == Node.ELEMENT_NODE: |
610 |
if n.nodeType == Node.ELEMENT_NODE: |
610 |
if (n.nodeName == "header"): |
611 |
if (n.nodeName == "header"): |
Lines 613-619
Link Here
|
613 |
if n.nodeType == Node.ELEMENT_NODE: |
614 |
if n.nodeType == Node.ELEMENT_NODE: |
614 |
if (n.nodeName == "group"): |
615 |
if (n.nodeName == "group"): |
615 |
parseGroupCDocs(n) |
616 |
parseGroupCDocs(n) |
616 |
print "}" |
617 |
print("}") |
617 |
|
618 |
|
618 |
if __name__ == '__main__': |
619 |
if __name__ == '__main__': |
619 |
main() |
620 |
main() |