16 KnownTypes=[
'Boolean',
'Integer',
'Real',
'String',
'File',
'Path',
'BooleanVector',
'IntegerVector',
'ResidueChainVector',
'RealVector',
'StringVector',
'FileVector',
'PathVector']
29 if s[0] ==
'"' and s[-1] ==
'"':
return s
30 else:
return '"' + s +
'"'
35 def __init__(self, name=None, ctype=None, group=None, desc="No description", short="",
37 lower=
None, upper=
None, default=
None, legal=
None, n=
None, n_lower=
None, n_upper=
None, restrict_access=
False):
39 if ctype
not in KnownTypes:
40 print 'Unknown type:%s!!!' % ctype
42 if default ==
'none' or default ==
'None':
43 print '*** Option %(name)s will default to the *string* "%(default)s"' % vars()
44 print ' If you want no default, write default=None (no quotes)'
54 if ctype ==
'String' or ctype ==
'Path' or ctype ==
'File' or \
55 ctype ==
'StringVector' or ctype ==
'PathVector' or ctype ==
'FileVector':
56 if ctype ==
'StringVector':
70 namespaces = self.group.split(
':')
72 if len(namespaces) > level:
73 return namespaces[level]
77 if str( self.
name[:1] ).isdigit() :
return 'n' + self.
name
78 else:
return self.
name
83 s +=
'option.add( basic::options::OptionKeys::'
85 s += self.group.replace(
':',
'::')+
'::'
87 if self.
short: s+=
'.shortd( "' + self.
short +
'" )'
88 if self.
lower : s+=
'.lower(' + self.
lower +
')'
89 if self.
upper : s+=
'.upper(' + self.
upper +
')'
90 if self.
n: s+=
'.n(' + self.
n +
')'
95 s+=
'.legal(' + self.
legal +
')'
98 s+=
'.legal(' + l +
')'
104 s+=
'.def(' + d +
')'
116 for ns
in self.group.split(
':'):
117 s +=
'namespace ' + ns +
' { '
119 s +=
'extern '+ self.
ctype+
'OptionKey const '+self.
getCName()+
';'
126 for ns
in self.group.split(
':'):
127 s +=
'namespace ' + ns +
' { '
134 if self.
name != self.group.split(
':')[-1] : s +=
':' + self.
name
136 s+=
'" ); ' + se +
'\n'
141 def smStr(s):
return s
or ''
144 s +=
' | -%(name)s <%(ctype)s>\n' % {
'name':self.
name,
'ctype':self.
ctype}
145 s +=
' | ' + self.
desc +
'\n'
146 s +=
' | ' + smStr(self.
lower) +
'-' + smStr(self.
upper) +
'\n'
147 if self.
legal==
'true' and self.
default==
'true': s +=
' |\n'
150 s +=
' | ' + str( self.
default ) +
'\n'
151 else: s +=
' | ' + smStr(self.
default) +
'\n'
152 s +=
' | -' + self.
oldName +
'\n'
158 def smStr(s):
return s
or ''
161 s +=
'<dt><b>-%(name)s</b> \\<%(ctype)s\\><dt>\n' % {
'name':self.
name,
'ctype':self.
ctype}
162 s +=
'<dd>' + self.
desc +
'</dd><br>\n'
164 s +=
'<dd>Range: ' + smStr(self.
lower) +
'-' + smStr(self.
upper) +
'</dd><br>\n'
170 if df: s +=
'<dd>Default: ' + df +
'</dd><br>\n'
179 def smStr(s):
return s
or ''
181 s =
'<dt><b>-%(name)s</b> \\<%(ctype)s\\></dt>\n' % {
'name':self.
name,
'ctype':self.
ctype}
182 s +=
'<dd>' + self.
desc +
'<br/>'
184 s +=
'Range: ' + smStr(self.
lower) +
'-' + smStr(self.
upper) +
'<br/>'
190 if df: s +=
'Default: ' + df +
'<br/>'
201 else: res.append( o )
204 found_option_for_group =
False
206 if o.group: o.group = group +
':' + o.group
207 else: o.group = group
209 found_option_for_group =
True
210 o.is_option_group =
True
213 if not found_option_for_group:
214 o =
Option( group,
'Boolean', group=group, desc=group+
" option group", legal=
'true', default=
'true' )
215 o.is_option_group =
True
221 l = map(mapFunction, opt_list)
222 f =
file(fileName,
'wb'); f.write(
"".
join(l) ); f.close()
228 if prevGroup != o.group:
229 if prevGroup : s +=
' |}\n'
230 s +=
"""{| border="1" cellpadding="10" width="100%"\n |+ '''""" + (o.group
or '')
231 s +=
" Option Group'''\n"
232 s +=
' ! Option name\n'
233 s +=
' ! Description\n'
238 s += o.getWikiTableRow()
244 s =
"/*!\n@page full_options_list Rosetta command line option descriptions.\n"
245 s +=
"<i>(This is an automatically generated file, do not edit!)</i> Generated: "+time.strftime(
"%Y-%m-%d")+
"\n"
249 if prevGroup != o.group:
250 if prevGroup : s +=
' </li>\n'
251 s +=
"<li><h2>" + (o.group
or '') +
"</h2>\n"
252 s += o.getDoxygenRow()
254 return s +
"</ul>\n */\n"
258 s =
"# List of Rosetta command line options.\n\n"
259 s +=
"_(This is an automatically generated file, do not edit!)_\n"
260 s +=
"Generated: " + time.strftime(
"%Y-%m-%d") +
"\n\n"
261 s +=
"_Note that some application specific options may not be present in this list._\n\n"
266 if prevGroup != o.group:
267 hlevel=
min(6,
len(o.group.split(
":"))+1)
270 s +=
"+ <h"+str(hlevel)+
">-" + (o.group
or '') +
"</h"+str(hlevel)+
">\n"
273 s += o.getMarkdownRow()
BooleanOptionKey const range
BooleanOptionKey const enumerate
Fstring::size_type len(Fstring const &s)
Length.
BooleanOptionKey const file