dxx-rebirth/d2x-rebirth/libmve/mvelib.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

118 lines
2.2 KiB
C

#ifndef INCLUDED_MVELIB_H
#define INCLUDED_MVELIB_H
#include <stdio.h>
#include <stdlib.h>
#include "libmve.h"
#ifdef __cplusplus
extern mve_cb_Read mve_read;
extern mve_cb_Alloc mve_alloc;
extern mve_cb_Free mve_free;
extern mve_cb_ShowFrame mve_showframe;
extern mve_cb_SetPalette mve_setpalette;
/*
* structure for maintaining info on a MVEFILE stream
*/
struct MVEFILE
{
void *stream;
unsigned char *cur_chunk;
int buf_size;
int cur_fill;
int next_segment;
};
/*
* open a .MVE file
*/
MVEFILE *mvefile_open(void *stream);
/*
* close a .MVE file
*/
void mvefile_close(MVEFILE *movie);
/*
* get size of next segment in chunk (-1 if no more segments in chunk)
*/
int mvefile_get_next_segment_size(MVEFILE *movie);
/*
* get type of next segment in chunk (0xff if no more segments in chunk)
*/
unsigned char mvefile_get_next_segment_major(MVEFILE *movie);
/*
* get subtype (version) of next segment in chunk (0xff if no more segments in
* chunk)
*/
unsigned char mvefile_get_next_segment_minor(MVEFILE *movie);
/*
* see next segment (return NULL if no next segment)
*/
unsigned char *mvefile_get_next_segment(MVEFILE *movie);
/*
* advance to next segment
*/
void mvefile_advance_segment(MVEFILE *movie);
/*
* fetch the next chunk (return 0 if at end of stream)
*/
int mvefile_fetch_next_chunk(MVEFILE *movie);
/*
* callback for segment type
*/
typedef int (*MVESEGMENTHANDLER)(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context);
/*
* structure for maintaining an MVE stream
*/
struct MVESTREAM
{
MVEFILE *movie;
void *context;
MVESEGMENTHANDLER handlers[32];
};
/*
* open an MVE stream
*/
MVESTREAM *mve_open(void *stream);
/*
* close an MVE stream
*/
void mve_close(MVESTREAM *movie);
/*
* reset an MVE stream
*/
void mve_reset(MVESTREAM *movie);
/*
* set segment type handler
*/
void mve_set_handler(MVESTREAM *movie, unsigned char major, MVESEGMENTHANDLER handler);
/*
* set segment handler context
*/
void mve_set_handler_context(MVESTREAM *movie, void *context);
/*
* play next chunk
*/
int mve_play_next_chunk(MVESTREAM *movie);
#endif
#endif /* INCLUDED_MVELIB_H */