dxx-rebirth/similar/editor
Kp 073f00974a Eliminate uses of the typedef struct X { ... } X; pattern
C++ does not require this pattern.

import re, fileinput
to = re.compile(r'^typedef struct ([a-z_A-Z]+)\s*{')
tc = re.compile(r'^}(.*?)\s*([a-z_A-Z]+);$')
osn = None
for line in fileinput.input(inplace=True):
	m = to.match(line)
	if m:
		osn = m.group(1)
		print 'struct %s\n{' % osn
		continue
	if osn:
		m = tc.match(line)
		if m:
			csn = m.group(2)
			if osn == csn:
				print '}%s;' % m.group(1)
				osn = None
				continue
			else:
				osn = None
	print line,
2013-12-28 22:48:07 +00:00
..
autosave.cpp
centers.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
curves.cpp
eglobal.cpp
elight.cpp
eobject.cpp Move object* -> objnum conversion into init_ai_object 2013-12-28 22:10:24 +00:00
eswitch.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
group.cpp
info.cpp
kbuild.cpp
kcurve.cpp
kfuncs.cpp
kgame.cpp
khelp.cpp
kmine.cpp
ksegmove.cpp
ksegsel.cpp
ksegsize.cpp
ktmap.cpp
kview.cpp
med.cpp
meddraw.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
medmisc.cpp
medrobot.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
medsel.cpp
medwall.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
mine.cpp
objpage.cpp
segment.cpp
seguvs.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
texpage.cpp Eliminate uses of the typedef struct X { ... } X; pattern 2013-12-28 22:48:07 +00:00
texture.cpp