//Api wrapped

struct ImageData
{
	char* Name;
	char* Alt;
	DWORD Handle;
	int x;
	int y;
};

struct ExportImageData
{
	ImageData* Image;
	ExportImageData* Next;
};

struct rect
{
    long Bottom;
    long Left;
    long Right;
    long Top;
};

struct SearchRes
{
	char* Data;
	SearchRes* Next;
};
//C++ simple API (for use with GosScript API)
/*
void __stdcall gosGml_InitializeProcessor(const char * iniPath);
void __stdcall gosGml_Run();
void __stdcall gosGml_Sleep();
void __stdcall gosGml_ShutdownProcessor();

//this being the GosScript API
	//gosScript_RegisterCallback("RawTextGotClick",	(GOSSCRIPTCALLBACK) RawTextGotClick,	GOSVAR_STRING,	0, 0);// -- do not delete the string
	//gosScript_RegisterCallback("settab",			(GOSSCRIPTCALLBACK) SetTab,				GOSVAR_INT,		0, 0);
	//gosScript_RegisterCallback("textsidedraw",		(GOSSCRIPTCALLBACK) TextSideDraw,		GOSVAR_INT,		0, 0);
	//gosScript_RegisterCallback("textgotclick",		(GOSSCRIPTCALLBACK) TextGotClick,		GOSVAR_INT,		0, 0);
	//gosScript_RegisterCallback("HistoryAdd",		(GOSSCRIPTCALLBACK) HistoryAddCB,		GOSVAR_INT,		0, 0);
	//gosScript_RegisterCallback("ForwardsGotClick",	(GOSSCRIPTCALLBACK) ForwardsGotClickCB,	GOSVAR_INT,		0, 0);
	//gosScript_RegisterCallback("BackGotClick",		(GOSSCRIPTCALLBACK) BackGotClickCB,		GOSVAR_INT,		0, 0);
	//gosScript_RegisterCallback("ShutDown",			(GOSSCRIPTCALLBACK) gosShutdownProcessor,	GOSVAR_INT, 0, 0);
	//gosScript_RegisterCallback("Initialize",		(GOSSCRIPTCALLBACK) gosInitializeProcessor,	GOSVAR_INT, 0, 0);
	//gosScript_RegisterCallback("Run",				(GOSSCRIPTCALLBACK) gosRun,			GOSVAR_INT,		0, 0);





//History List
char* __stdcall gosHistoryBack(); //move the history lists back 1 member and return the previous page **DOES NOT CHANGE THE PAGE DISPLAYED**
char* __stdcall gosHistoryForwards(); //move the history lists forward 1 member and return the next page **DOES NOT CHANGE THE PAGE DISPLAYED**
bool __stdcall gosBackIsEmpty(); //is the back portion of the history list empty?
bool __stdcall gosForwardsIsEmpty(); //is the forwards portion of the history list empty?

int __stdcall gosBackGotClick(); //call to move back in the history list **DOES CHANGE THE PAGE DISPLAYED**
int __stdcall gosForwardsGotClick(); //call to move forward in the history list **DOES CHANGE THE PAGE DISPLAYED**
void __stdcall gosHistoryAdd(char* Str); //call to add an entry to the history list **DOES NOT CHANGE THE PAGE DISPLAYED**

void __stdcall gosHistoryClear(); //call to clear the history lists



int _stdcall gosSetTab(void * instance, int nargs, void * args[16]); //set the number of pixels that a tab represents. - not yet implemented 7/7/00
int _stdcall gosTextSideDraw(void * instance, int nargs, void * args[16]); //draw that gml, in the array pass left,top,right,bottom. This is the screen area to display gml to.

char* _stdcall gosRawTextGotClick(int x, int y); //feed in an x and y pair relative to the top left of the text area (if you scroll, be sure to take that into account) -- do not delete the char*
int _stdcall gosTextGotClick(void * instance, int nargs, void * args[16]); //args[0]=x,args[1]=y. Tests for hit and on hit changes page, modifies history lists

SearchRes* __stdcall gosSearch(const char* Target);  //search the index file for a keyword. - not yet implemented 7/7/00
void __stdcall gosJump(const char* Target); //Jump to another GML file, modifies history list



//Really Raw API - if you want to do the details yourself.

DWORD __stdcall gosGml_RRCreateDisplay(char* fontPath, char* imagePath, rect* DisplayTextArea, int tabwidth); //create Gml system window, blank
void __stdcall gosGml_RRDestroyDisplay(DWORD Victim); //destroy a Gml system window
int __stdcall gosGml_RRDisplayGML(char* TextData, DWORD DisplaySystem); //display this Gml; does not clear pane if that is relevant
void __stdcall gosGml_RRClearGML(DWORD DisplaySystem); //clear the Gml system, if relevant
char* __stdcall gosGml_RRClick(int X, int Y, DWORD DisplaySystem);

DWORD __stdcall gosGml_RRCreateHistory(); //create a history system
void __stdcall gosGml_RRDestroyHistory(DWORD Victim); //destroy a history system
char* __stdcall gosGml_RRHistoryForward(DWORD HistorySystem); //move forwards in history list, return next page
char* __stdcall gosGml_RRHistoryBack(DWORD HistorySystem); //move backwards in history list, return previous page
void __stdcall gosGml_RRHistoryAdd(char* Entry, DWORD HistorySystem); //add item to history list, clear all forward items
void __stdcall gosGml_RRHistoryClear(DWORD HistorySystem); //clear history list
bool __stdcall gosGml_RRHistoryForwardEmpty(DWORD HistorySystem); //are there any forward items?
bool __stdcall gosGml_RRHistoryBackEmpty(DWORD HistorySystem); //are there any back items?

//bool __stdcall InternalTest();
*/











































////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
//Begin Rei API																			  //
////////////////////////////////////////////////////////////////////////////////////////////
//This API is completely independant of any other API. Do not Mix various APIs. The       //
//purpose of the Rei API is to surpass all previous APIs in terms of power and simplicity.//
//Some basic rules:                                                                       //
//                 Never delete anything given out by the APIs                            //
//                 Never delete anything passed into the APIs                             //
//                 Start counting at 0                                                    //
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////






////////////////////////////////////////////////////////////////////////////////////////////
//Begin Data Types                                                                        //
////////////////////////////////////////////////////////////////////////////////////////////
//All data types and definitions are in this section.                                     //
////////////////////////////////////////////////////////////////////////////////////////////
struct GMLHyperlink
{
	char* Name;
	char* Target;
	char* Alt;
};
struct ExportHyperlink
{
	GMLHyperlink* HLink;
	ExportHyperlink* Next;
};
/*struct ImageData
{
	char* Name;
	char* Alt;
	DWORD Handle;
	int x;
	int y;
};
struct ExportImageData
{
	ImageData* Image;
	ExportImageData* Next;
};*/
typedef void (*RolloverCallback)(int x, int y, char* ImageName, int ImageID);
typedef char* (*ParserCallback)(char* ID);
////////////////////////////////////////////////////////////////////////////////////////////
//End Data Types                                                                          //
////////////////////////////////////////////////////////////////////////////////////////////
//All data types and definitions are in this section.                                     //
////////////////////////////////////////////////////////////////////////////////////////////




class GML
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
//Begin Core APIs                                                                         //
////////////////////////////////////////////////////////////////////////////////////////////
//The core APIs are the APIs without which nothing else would be worthwhile.              //
////////////////////////////////////////////////////////////////////////////////////////////
GML(char* fontPath, char* imagePath, char* defaultPagePath, rect* DisplayTextArea, int tabwidth);	//create a GML display system. Must be called before any other Core APIs
~GML();																								//destroy a GML display system. Must be called when you no longer need a History system.
int DisplayGML(char* TextData);																	//Display a page of GML
////////////////////////////////////////////////////////////////////////////////////////////
//End Core APIs                                                                           //
////////////////////////////////////////////////////////////////////////////////////////////
//The core APIs are the APIs without which nothing else would be worthwhile.              //
////////////////////////////////////////////////////////////////////////////////////////////





////////////////////////////////////////////////////////////////////////////////////////////
//Begin Hyperlink Gamepad API                                                             //
////////////////////////////////////////////////////////////////////////////////////////////
//This section of the API is intended for use with gamepads, this will allow enumeration  //
//and 'click'ing of any Hyperlink without a mouse or other pointer.                       //
////////////////////////////////////////////////////////////////////////////////////////////
ExportHyperlink* ExportHyperlinks();//export hyperlink list for this page
GMLHyperlink* GetHyperlink(int Num);	//"click" on the number Num hyperlink.
GMLHyperlink* GetHyperlink(char* Desc);	//"click" on the hyperlink that has Desc as the text in the Alt tag. GML pages must be constructed with this in mind.
////////////////////////////////////////////////////////////////////////////////////////////
//End Hyperlink Gamepad API                                                               //
////////////////////////////////////////////////////////////////////////////////////////////
//This section of the API is intended for use with gamepads, this will allow enumeration  //
//and 'click'ing of any Hyperlink without a mouse or other pointer.                       //
////////////////////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////////////////////////////////
//Begin Mouse APIs                                                                        //
////////////////////////////////////////////////////////////////////////////////////////////
//The mouse (pointer) APIs are intended to supply everything needed for full mouse support//
//including rollover events and clicking.                                                 //
////////////////////////////////////////////////////////////////////////////////////////////
char* Click(int x, int y);		//pointer click. make sure x/y is relative to the top left corner of the display window
void RollOver(int x, int y);	//pointer is at this screen location, test for rollover. make sure x/y is relative to the top left corner of the display window
ExportImageData* ExportImageList();	//Export information on all images.
void RegisterRollover(ImageData* Image, RolloverCallback* F);	//Register a function to be called in the event that this image is rolled over.
////////////////////////////////////////////////////////////////////////////////////////////
//End Mouse APIs                                                                          //
////////////////////////////////////////////////////////////////////////////////////////////
//The mouse (pointer) APIs are intended to supply everything needed for full mouse support//
//including rollover events and clicking.                                                 //
////////////////////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////////////////////////////////
//Begin File API                                                                          //
////////////////////////////////////////////////////////////////////////////////////////////
//The File API is intended to allow loading and location of local and remote files.       //
////////////////////////////////////////////////////////////////////////////////////////////
char* LoadPage(const char* FileName);	//Load page. Supports UNC, http, and local paths. Does _not_ support relative paths! use LocateFile first.
char* LoadFile(const char* FileName);	//Load file. Supports UNC, http, and local paths. Does _not_ support relative paths! use LocateFile first.
char* LocateFile(const char* FileName);	//Locates a file given a path that may be relative. It's safe to always run anything sent to LoadFile through this first. Be sure delete the return value eventually.
////////////////////////////////////////////////////////////////////////////////////////////
//Begin File API                                                                          //
////////////////////////////////////////////////////////////////////////////////////////////
//The File API is intended to allow loading and location of local and remote files.       //
////////////////////////////////////////////////////////////////////////////////////////////
void ManageVideo(HGOSVIDEO I);	//Add to video list to be destroyed when page is switched
void ManageImage(DWORD I);		//Add to video list to be destroyed when page is switched
void SetScrollOffset(int y);
void SetParserCallback(ParserCallback* PCB);
private:
	GML();
	int a,b,c,d,e,f;
};


class HistoryS
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
//Begin History API																		  //
////////////////////////////////////////////////////////////////////////////////////////////
//This section of the API is devoted to the HISTORY object. If you don't want one, don't  //
//use this. Note that none of these APIs will change the page being displayed.            //
//Note also that NO OTHER API calls will change the history list.                         //
////////////////////////////////////////////////////////////////////////////////////////////
HistoryS();					//create a history system.
~HistoryS();				//destroy a history system.
char* HistoryBack();		//move the history lists back 1 member and return the previous page **DOES NOT CHANGE THE PAGE DISPLAYED**
char* HistoryForwards();	//move the history lists forward 1 member and return the next page **DOES NOT CHANGE THE PAGE DISPLAYED**
bool BackIsEmpty();			//is the back portion of the history list empty? Informational API only.
bool ForwardsIsEmpty();		//is the forwards portion of the history list empty? Informational API only.
void HistoryAdd(char* Entry);//call to add an entry to the history list **DOES NOT CHANGE THE PAGE DISPLAYED**
void HistoryClear();		//call to clear the history lists
void GMLSetHistoryLen();		//Enable a limited length Back history list. Length is unlimited by default.
////////////////////////////////////////////////////////////////////////////////////////////
//End History API																		  //
////////////////////////////////////////////////////////////////////////////////////////////
//This section of the API is devoted to the HISTORY object. If you don't want one, don't  //
//use this. Note that none of these APIs will change the page being displayed.            //
////////////////////////////////////////////////////////////////////////////////////////////
};


////////////////////////////////////////////////////////////////////////////////////////////
//Table of Contents controller.                                                           //
////////////////////////////////////////////////////////////////////////////////////////////
//The TOC will create a second GML frame and display a Table of Contents there.           //
////////////////////////////////////////////////////////////////////////////////////////////
class Toc
{
	public:
		Toc(char* Input, char* fontPath, char* imagePath, char* defaultPagePath, rect* DisplayTextArea, int tabwidth);
		~Toc();
		char* Click(int x, int y);
		int Draw();
		void SetScrollOffset(int x);
	private:
		int a,b,c,d,e;
};

class Index
{
	public:
		Index(char* Input, char* fontPath, char* imagePath, char* defaultPagePath, rect* DisplayTextArea, int tabwidth);
		~Index();
		char* Click(int x, int y);
		int Draw();
		void SetScrollOffset(int x);
		void HighLight(char* Text);	//highlight the first item starting with this string
	private:
		int a,b,c,d,e,f,g,h;
};



////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
//End Rei API                                                                             //
////////////////////////////////////////////////////////////////////////////////////////////
//This API is completely independant of any other API. Do not Mix various APIs. The       //
//purpose of the Rei API is to surpass all previous APIs in terms of power and simplicity.//
//Some basic rules:                                                                       //
//                 Never delete anything given out by the APIs                            //
//                 Never delete anything passed into the APIs                             //
//                 Start counting at 0                                                    //
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                        //
////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                        //
//                                                                                        //
//                                                                                        //
//                                                                                        //
//                                                                                        //
//                                                                                        //
////////////////////////////////////////////////////////////////////////////////////////////