mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-12 23:54:33 +00:00
better output (includes source file and line)
This commit is contained in:
parent
8e7499cb1b
commit
f3e8b3ffcc
1 changed files with 22 additions and 5 deletions
|
@ -15,6 +15,24 @@ cvar_def_re = re.compile(r'Cvar_Get\s*\(\s*(("' +
|
||||||
r'"\s*)+)\)\s*;')
|
r'"\s*)+)\)\s*;')
|
||||||
cvar_get_re = re.compile(r'=\s*Cvar_Get')
|
cvar_get_re = re.compile(r'=\s*Cvar_Get')
|
||||||
|
|
||||||
|
class cvar:
|
||||||
|
def __init__(self, name, default, flags, desc, source):
|
||||||
|
self.name = name
|
||||||
|
self.default = default
|
||||||
|
self.flags = string.split (flags, '|')
|
||||||
|
self.desc = desc
|
||||||
|
self.source = source
|
||||||
|
def __repr__(self):
|
||||||
|
return 'cvar(('+`self.name`+','+\
|
||||||
|
`self.default`+','+\
|
||||||
|
`string.join(self.flags,'|')`+','+\
|
||||||
|
`self.desc`+','+\
|
||||||
|
`self.source`+')'
|
||||||
|
def __str__(self):
|
||||||
|
return self.name+'\n\t'+self.default+'\n\t'+`self.flags`+'\n\t'+self.desc+'\n\t'+self.source[0]+':'+`self.source[1]`
|
||||||
|
|
||||||
|
cvars = []
|
||||||
|
|
||||||
def clean(str):
|
def clean(str):
|
||||||
str=string.strip(str)
|
str=string.strip(str)
|
||||||
if str[0]=='"':
|
if str[0]=='"':
|
||||||
|
@ -36,19 +54,18 @@ def get_cvar_defs(fname):
|
||||||
j=j+1
|
j=j+1
|
||||||
l = string.join(f[i:i+j],'')
|
l = string.join(f[i:i+j],'')
|
||||||
m = cvar_def_re.search(l)
|
m = cvar_def_re.search(l)
|
||||||
i=i+j
|
|
||||||
g = m.groups()
|
g = m.groups()
|
||||||
if g[2]:
|
if g[2]:
|
||||||
name = g[2]
|
name = g[2]
|
||||||
default = clean(g[4])
|
default = clean(g[4])
|
||||||
flags = g[11]
|
flags = g[11]
|
||||||
desc = clean(g[12])
|
desc = clean(g[12])
|
||||||
print name
|
cvars.append (cvar (name, default, flags, desc, (fname, i+1)))
|
||||||
print '\t'+default
|
i=i+j
|
||||||
print '\t'+flags
|
|
||||||
print '\t'+desc
|
|
||||||
else:
|
else:
|
||||||
i=i+1
|
i=i+1
|
||||||
|
|
||||||
for f in sys.argv[1:]:
|
for f in sys.argv[1:]:
|
||||||
get_cvar_defs(f)
|
get_cvar_defs(f)
|
||||||
|
for c in cvars:
|
||||||
|
print c
|
||||||
|
|
Loading…
Reference in a new issue