/*
Copyright (c) 2000-2001 Olivier Dagenais

This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use
of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is not
required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.
*/
#ifndef __types_h__
#define __types_h__

#include "SDL.h"
#ifdef WIN32
	#include <windows.h>
#endif
#include "SDL_loadso.h"

#ifdef _DEBUG
	#define Trace(message) fprintf ( stderr, "TRACE: %s\n  in file %s, line %d\n", message, __FILE__, __LINE__ );
#else
	#define Trace(message) ;
#endif

typedef signed long PARAM;

typedef bool (* lpFunc0) ();
typedef bool (* lpFunc1) (PARAM);
typedef bool (* lpFunc2) (PARAM, PARAM);
typedef bool (* lpFunc3) (PARAM, PARAM, PARAM);
typedef bool (* lpFunc4) (PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc5) (PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc6) (PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc7) (PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc8) (PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc9) (PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc10)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc11)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc12)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc13)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc14)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc15)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);
typedef bool (* lpFunc16)(PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM, PARAM);


typedef struct
{
	unsigned long numParams;
	unsigned long startTime;
	unsigned long endTime;
	void * functionPointer;
	char * libraryName;
	char * functionName;
	PARAM * startParameters;
	PARAM * endParameters;
} EventStruct;


typedef struct
{
	unsigned long numEvents;
	EventStruct * events;
} TrackStruct;


typedef struct
{
	unsigned long numParameters;
	void * pointerToFunction;
	char * functionName;
} FunctionStruct;


typedef struct
{
	char * libraryName;
	unsigned long numFunctions;
	FunctionStruct * functions;
	void * pointerToInitFunction;
	void * pointerToBeginNewFrameFunction;
	void * pointerToQuitFunction;
	void * libraryHandle;
} LibraryStruct;



typedef struct
{
	unsigned long numTracks;
	TrackStruct * tracks;
	unsigned long runningTime;
	bool useOpenGL;
	unsigned long numInputSurfaces;
	SDL_Surface ** inputSurfaces;
	unsigned long numOutputSurfaces;
	SDL_Surface ** outputSurfaces;
	unsigned long numLibraries;
	LibraryStruct * libraries;
	char * musicFile;
} DemoStruct;



void destroyStringBuffer ( char * string );
void destroyDemo ( DemoStruct & aDemo );


#endif
