dxx-rebirth/d2x-rebirth/include/pngfile.h
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

22 lines
344 B
C

#ifndef PNGFILE_H
#define PNGFILE_H
struct png_data
{
unsigned int width;
unsigned int height;
unsigned int depth;
unsigned int channels;
unsigned paletted:1;
unsigned color:1;
unsigned alpha:1;
unsigned char *data;
unsigned char *palette;
unsigned int num_palette;
};
extern int read_png(char *filename, png_data *pdata);
#endif