********************************************************************************
	"Easy Gem" library Copyright (c)1995 by		Christophe BOYANIQUE
																29 rue de la Rpublique
																37230 FONDETTES
																FRANCE
												FidoNet:		2:320/107.16
												NeST:			90:800/1.16
												AtariNet:	51:901/1.16
										*small* mail at:	cb@spia.freenix.fr
********************************************************************************
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 2 of the License, or any later version.
   This program is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
   more details.
   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   675 Mass Ave, Cambridge, MA 02139, USA.
********************************************************************************
	Tab size: 3
********************************************************************************


********************************************************************************
	This is a very short documentation, I have no time to write a real doc...
	It only contains information about using EGLib; but nothing about modifying
	it !
********************************************************************************


********************************************************************************
	How EGlib works ?
********************************************************************************
Eglib is a library that will be linked to a program. EGlib make all the hard
work about memory, aes, vdi, keyboard, etc...
To save hard disk space; EGlib will soon be modular. For this, EGlib need a
space in your hard disk called the EGLIB.SYS folder. This folder can be placed
anywhere (even on subdirectories) on your hard disk, but the final folder name
must be EGLIB.SYS; any program linked with EGlib will not work without a correct
EGlib folder.
So, at program startup, EGlib must find the EGLIB.SYS folder. To find it; EGlib
will look in a file called EGLIB.INI the path to the folder. This file must be
on the booting [hard/ram] drive; and contain the complete path to the folder
until EGLIB.SYS. If the computer boots on drive D: and EGLIB.SYS is located
as F:\DUMMY\GEM\EGLIB.SYS\ the EGLIB.INI must be on drive D, and contain just
the single line:

F:\DUMMY\GEM\

Let's come back to the EGLIB.SYS. This folder will contain many subdirectories.
First there will be a directory for EGlib itself. For EGlib v1.22 it will be
called EGLIB122 (for the case there are programs using differents version of
EGlib). Then there will be a folder for each program that use EGlib. For
exemple, by now, there is Bv3 or POVshell that use EGlib. So there will be
in  the EGLIB.SYS directory:

F:\DUMMY\GEM\EGLIB.SYS\BV3\
                       EGLIB122\
                       POVSHELL\

In each of this directories (execpt EGLIB122), will be written the INI and
the LOG file.
The INI file will contain all the EGlib and the program parameters.
The LOG file will contain information about EGlib or the program which is
running. For example, EGlib write here the RSC file that are loaded; or Bv3
write the informations about loaded pictures.
Plus, there will be a subdirectory by language. By now only French and English
are implemented (German can be add easily). 
So the Bv3 directory should be:

F:\DUMMY\GEM\EGLIB.SYS\BV3\ENGLISH\
                           FRENCH\
                           BV3.INI
                           BV3.LOG

Then, at least, the language directories (FRENCH & ENGLISH) will contain the
RSC file of the program (or EGlib RSC for EGLIB122) and a subdirectory which
will contain all the help files, named HELP.
In this distribution pack you should find:

EGLIB.SYS\EGLIB122\ENGLISH\HELP\*.HLP
                           EGLIB.RSC
                   FRENCH\HELP\*.HLP
                          EGLIB.RSC
          EGLIBTST\ENGLISH\HELP\*.HLP
                          EGLIBTST.RSC
                   FRENCH\HELP\*.HLP
                          EGLIBTST.RSC
                   EGLIBTST.INI
                   EGLIBTST.LOG

But in fact there is no HELP directories in EGLIBTST because EGLIBTST is a very
small example program with no help files.

Then, the program itself can be located anywhere on the disk; because EGlib
will search the EGLIB.INI file then the EGLIB.SYS folder to find the INI files
and the RSC.


********************************************************************************
	RSC files
********************************************************************************
A GEM program is based around the interface; and the interface is designed as a
RSC file. So, before programming anything; you should make a complete RSC file
in the language of your choice; then make a copy of the file and a translation
for the second language. The two RSC files must have the same structures (tree,
objetcs must be identical except for the text of course) because the program
doesn't take care of the language when using the RSC file.
RSC file can be made with any editor; but I suggest you to use Interface which
is the best RSC editor. EGlib can handle any RSC file format: old, Interface
extended file format and new AES v3.x format with color icons.
The RSC will contain the interface of your program but all the keyboard
shortcuts, and should contain all texts and alerts used by the program as free
strings or alerts. The reason is simple. For example if you want to use an alert
box to prevent a saving error you can do:

if (glb.opt.Language==L_FRENCH)
	form_alert(1,"[3][|Erreur d'criture lors|de la sauvegarde!][ Annuler ]");
else if (glb.opt.Language==L_ENGLISH)
	form_alert(1,"[3][|Writing error while|saving the file !][ Cancel ]");

But if you wait for a response you must do:

if (glb.opt.Language==L_FRENCH)
	a=form_alert(1,"[3][|Erreur d'criture lors|de la sauvegarde!][ Annuler | Ressayer ]");
else if (glb.opt.Language==L_ENGLISH)
	a=form_alert(1,"[3][|Writing error while|saving the file !][ Cancel | Retry ]");
if (a==1)
	...
else
	...

This is not easy to handle (extra variable a); this use memory (there is both
the english and french texts in memory).
But if you put your alert texts in the RSC; code will be:

if ( form_alert(1,iglb.rsc.head.frstr[SAVE_ERROR]) == 1 )
	...
else
	...

You don't take care of the language, you save memory and the code is more
simple.

You can put a lot of usefull informations in the RSC file and use new type
of AES objects in the formulars. By formular I mean formulars in a window.
EGlib have not any function to handle single formular (ie not in a window,
but it is possible to make a formular window to be modal: it is impossible
to perform any action (menu, other windows) before closing it).

When loading the RSC file EGlib transform all objects to USERDEF objects to
perform the great interface you can see. So, even on a single STF or on the
last Medusa/Eagle you own exactly the SAME interface.

Menu Shortcuts:
===============
The menu tree can contain shortcuts. There is two ways to define them in
the RSC file:
1/
The string of menu entries are of this type:
	"  Menu entry   ... "
	"  Informations  ^I "
The character at the 3 points level can contain:
	-	an ASCII code between 'A' & 'Z'; or 13 for RETURN; or 27 for ESCAPE
	-	the ASCII code 94 '^' for CONTROL key
	-	the ASCII code 7 for ALTERNATE key
	-	the ASCII code 1 for SHIFT key
2/
Put the standard key code in the Extended Type and the keyboard shift keys
status in the Extended State:
		bit 15:	SHIFT
		bit 14:	CONTROL
		bit 13:	ALTERNATE

Root Object:
============
But, if you want to handle a single formular with the AES form_do() or your
own function, you may prevent EGlib from transforming object in some trees;
you can do this with the bit 8 of the Extended State of the Root object.
The configuration saving file option saves in a file the position of all the
formormulars. Perhaps you don't want some windows to be opened by this way
at the program startup. Then, put the bit 9 of Extended State for the Root
object.

Image compatibility with low resolution:
========================================
This concerns G_ICON, G_CICON & G_IMAGE objects used in low resolution (when
lines are doubled): the aspect ratio of images and icons is not respected. If
you set the bit 15 of the Extended State then the image's height will be
divided by 2 and the ratio will be ok. BUT this is not nice: these only supress
one line for two and the result can be horrible !

New AES objects:
================
This value that can be put on the type object (0x0100 means 1 in extended type
of the object).
USD_CROSS		0x0100	Apply to a G_BUTTON:		String with a [checked] box
USD_ROUND		0x0200	Apply to a G_BUTTON:		String with a radio button
USD_POPUP		0x0300	Apply to a G_BUTTON:		PopUp menu Button
USD_XPOPUP		0x0400	Apply to a G_BUTTON:		Extended PopUp menu Button
USD_FRAME		0x0500	Apply to a G_BOXTEXT:	Frame with a title
USD_NUM			0x0600	Apply to a G_BUTTON:		Number with arrow
USD_DNARROW		0xFD00	Apply to a G_USERDEF:	down arrow
USD_UPARROW		0xFC00	Apply to a G_USERDEF:	up arrow
USD_LFARROW		0xFB00	Apply to a G_USERDEF:	left arrow
USD_RTARROW		0xFA00	Apply to a G_USERDEF:	right arrow
USD_LQARROW		0xF900	Apply to a G_USERDEF:	double left arrow
USD_RQARROW		0xF800	Apply to a G_USERDEF:	double right arrow

Extended State:
===============
The Extended State of TEXT/BOXTEXT/BUTTON & STRING objects can be used to
change the text aspect when drawing:
	bit 15:					Bold VDI attribute
	bit 14:					Light VDI attribute
	bit 13:					Underlined VDI attribute
	bit 11:					reserved
	bit 10:					Force to GDOS font
	bit  9:					Force to system font
	bit  8:					reserved
	WHITEBAK:				Force a grey background
	DRAW3D:					Draw a 3D perimeter
	WHITEBACK+DRAW3D:		for G_BUTTON only: 3D button !
For PopUp and Extended PopUp the bit 8 of Extended State means that the text
selectionned with the PopUp will not be drawn on the button.


********************************************************************************
	EGlib structure
********************************************************************************
EGlib use a huge structure to switch parameters between the program and each
part of EGlib. Take a look on the EGLIB.H which contains all the declarations;
here is a sum up of it:

AES sub-struct:
===============
int	id;					R	AES handle
int	ver;					R	AES version
int	multi;				R	multitask flag
int	type;					R	application flag
int	xdesk;				R	x dim of desk
int	ydesk;				R	y dim of desk
int	wdesk;				R	w dim of desk
int	hdesk;				R	h dim of desk
int	menu;					W	RSC tree for MENU
int	desk;					W	RSC tree for DESK
int	ic_tree;				W	Tree which contains icons
int	icon;					W	APP Iconified window
int	flag;					W	evnt_multi flag
int	f1,x1,y1,w1,h1;	W	in/out rect 1
int	f2,x2,y2,w2,h2;	W	in/out rect 2
int	timer1;				W	timer low byte
int	timer2;				W	timer high byte

RSC sub-struct:
===============
char		name[FILENAME_MAX];	W	Complete RSC file name
typedef struct
{
	long			nobs;				R	Total number of objects
	long			ntree;			R	Total number of trees
	long			nted;				R	Number of TEDINFO structs
	long			ncib;				R	Number of C_ICON structs
	long			nib;				R	Number of ICON structs
	long			nbb;				R	Number of BItBlock structs
	long			nfstr;			R	Number of Free Strings
	long			nfimg;			R	Number of Free Images
	OBJECT		*object;			R	Points to objects
	TEDINFO		*tedinfo;		R	Points to TEDINFO
	ICONBLK		*iconblk;		R	Points to ICONBLK
	BITBLK		*bitblk;			R	Points to BITBLK
	CICON			*cicon;			R	Points to CICON
	CICONBLK		*ciconblk;		R	Points to CICONBLK
	char			**frstr;			R	Points to Free Strings
	BITBLK		**frimg;			R	Points to Free Images
	OBJECT		**trindex;		R	Points to Trees
}	myRSHDR;							R	RSC Header
int		in;						R	Index of Memory
long		adr;						R	Adr of memory bloc
long		len;						R	Len of memory bloc
long		max;						R	Max len of bloc
UBLK		*ublk;					R	userdef array
CICON		*cicon;					R	color icon array

FONT array:
===========
This point to a FONT array. The array is of this type:
	char		name[34];			R	0..31: Name | 32: vectoriel flag
	int		index;				R	GDOS index

VDI sub-struct:
===============
int		ha;						R	andle
int		out[57];					R	out parameters
int		extnd[57];				R	extended out VDI parameters
int		xscr;						R	x dim of screen
int		yscr;						R	y dim of screen
int		wscr;						R	w dim of screen
int		hscr;						R	h dim of screen
int		wcell;					R	text cell width
int		hcell;					R	text cell height
int		wbox;						R	box width
int		hbox;						R	box height
int		gdos;						R	GDOS flag
int		vgdos;					R	GDOS version
int		nfont;					R	Number of GDOS fonts
int		low;						R	low rez flag

Functions sub-struct:
=====================
void	cdecl	(*init)(void);										General init
void	cdecl	(*iSig)(void);										Signals init
void	cdecl	(*iAes)(void);										AES init
void	cdecl	(*iVdi)(void);										VDI init
void	cdecl	(*iDiv)(void);										dummy init
void	cdecl	(*iObRsc)(int tree,int obj);					RSC objects init
void	cdecl	(*iDesk)(void);									desk init
void	cdecl	(*iLast)(void);									Last init
void	cdecl	(*eFirst)(void);									First exit
void	cdecl	(*eDiv)(void);										dummy exit
void	cdecl	(*eVdi)(void);										VDI exit
void	cdecl	(*eAes)(void);										AES exit
void	cdecl (*wPop)(int i,int n);							Window PopUp
void	cdecl	(*gMenu)(int opt);								Menu Event
void	cdecl	(*gTimer)(void);									Timer Event
void	cdecl	(*gBox1)(void);									Box 1 Event
void	cdecl	(*gBox2)(void);									Box 2 Event
void	cdecl	(*gKey)(int key);									KeyBoard Event
void	cdecl	(*gMesag)(int buf[8]);							Mesag Event
void	cdecl	(*gAcOpen)(void);									AcOpen Event
void	cdecl	(*gAcClose)(void);								AcClose Event
void	cdecl	(*gClicD)(int x,int y,int k);					Desk Clic Event
void	cdecl	(*gClicF)(int obj,int n,int nmb);			WinForm Clic Event
void	cdecl (*lFileIni)(char *tit,char *buf,char *p);	INI loading
void	cdecl (*sFileIni)(void);								INI saving

Options sub-struct:
===================
int		Win_Num;						W	Number of windows
int		Mem_Num;						R	Number of memory blocs
long		Mem_Len;						R	Len of allocated memory
long		Mem_Boot;					R	Len of memory at init
int		Gem_font;					R	Font in GEM
int		Gem_Dfont;					R	Default GDOS font in GEM
int		Gem_Ifont;					R	Intern GDOS font in GEM
int		Hlp_font;					R	Font in help
int		Hlp_Dfont;					R	Default GDOS font in help
int		Hlp_Ifont;					R	Intern GDOS font in help
int		Hlp_Font_Size;				R	Size of font in help
int		Hlp_Color_Text;			R	Text color in help
int		Hlp_Color_Back;			R	Background color in help
unsigned	Mouse_Form		:2;		R	Form to mouse
unsigned	Flash_PopUp		:1;		R	Flash the selected option
unsigned	Use_Font_Gem	:1;		R	Use font in GEM
unsigned	Use_Font_Hlp	:1;		R	Use font in HELP
unsigned	Log_File			:1;		R	Make a Log file
unsigned	Save_Config		:1;		R	Save config at exit
unsigned	Auto_Icon		:1;		R	Auto align icon
unsigned	Big_Icon			:1;		R	Use big icons
unsigned	Rev_Horiz		:1;		R	Reverse horizontal
unsigned	Rev_Verti		:1;		R	Reverse vertical
int		Language;					R	Language
int		Av_Lang;						R	Available languages
char		HLP_Path[FILENAME_MAX];	R	Path to help files
char		HLP_File[14];				W	Default help file
char		INI_File[FILENAME_MAX];	R	File w/Path to EGLIB.INI
char		LOG_File[FILENAME_MAX];	R	File w/Path to EGLIB.LOG
char		APP_Path[FILENAME_MAX];	R	Path to prg sys folder
char		Prog_Name[16];				W	Program name

Div sub-struct:
===============
long		sig[NSIG];					R	signal functions
char		path[FILENAME_MAX];		R	current directory
int		AccOp;						R	open ACC flag
int		Exit;							W	exit flag
int		MCH;							R	machine type
int		TOS;							R	TOS version
long		*fsel;						R	Points to Selectric cookie
char		log[LOG_MAX];				W	text to write in log
char		pname[FILENAME_MAX];		W	Path name for fileselect
char		pfname[FILENAME_MAX];	W	Path+File name
char		fname[14];					W	File name
char		ext[14];						W	Extension
char		tit[30];						W	Title


********************************************************************************
	Memory
********************************************************************************
EGlib use an intern Memory Manager which enhance the use of Memory. The major
feature is that EGlib unfrag the memory while allocating or freeing blocs.
At the startup, EGlib looks in the INI file the amount of memory to alloc; and
alloc it with a normal Malloc() call. Then, the program can alloc many blocs
that will be allocated in the EGlib bloc.
The EGlib bloc can be modified. To decrease the len there is no problem; but to
increase it, EGlib try to make a Malloc call, looks it the new allocated bloc
follows the old. If so the operation is successfull.
When allocatin blocs you can precise if the boc is free movable or if it is
unmovable. I suggest to use less unmovable blocs as possible; because they
prevent optimal unfrag of memory.
Memory blocs are used with the MEM struct:
typedef struct
{
	int	n;					R	Max number of _Malloc blocs
	long	tfre;				R	Total free lenght
	long	tlen;				R	Total lenght
	long	mfre;				R	Max free bloc len
	long	Badr[MEM_NMB];	R	Malloc adress
	long	Blen[MEM_NMB];	R	Malloc lenght
	typedef struct
	{
		long	adr;			R	bloc address
		long	len;			R	bloc len
		int	type;			R	bloc type
	}	*BLOC;
}	MEM;


********************************************************************************
	Keyboard
********************************************************************************
EGlib handle any type of keyboard (ie country) and use a special code for any
key. This is inspired from the NKCC standard code; but it is done without any
resident part of code. A standard key code is coded in an integer.

The low byte contains the ASCII or the key code:
	K_NIL			0x00			No Key
	K_UP			0x01			Cursor UP
	K_DOWN		0x02			cursor DOWN
	K_RIGHT		0x03			cursor RIGHT
	K_LEFT		0x04			cursor LEFT
	K_BS			0x08			BACKSPACE
	K_TAB			0x09			TAB
	K_ENTER		0x0A			ENTER
	K_INS			0x0B			INSERT
	K_CLRHOME	0x0C			CLR-HOME
	K_RETURN		0x0D			RETURN
	K_HELP		0x0E			HELP
	K_UNDO		0x0F			UNDO
	K_F1			0x10			Function Key #1
	K_F2			0x11			Function Key #2
	K_F3			0x12			Function Key #3
	K_F4			0x13			Function Key #4
	K_F5			0x14			Function Key #5
	K_F6			0x15			Function Key #6
	K_F7			0x16			Function Key #7
	K_F8			0x17			Function Key #8
	K_F9			0x18			Function Key #9
	K_F10			0x19			Function Key #10
	K_ESC			0x1B			ESCAPE
	K_DEL			0x7F			DELETE

The high byte contains misc informations:
	KF_FUNC		0x4000		Function flag
	KF_NUM		0x2000		Numeric pad
	KF_CAPS		0x1000		CapsLock
	KF_ALT		0x0800		Alternate
	KF_CTRL		0x0400		Control
	KF_SHIFT		0x0300		any Shift
	KF_LSH		0x0200		Left Shift
	KF_RSH		0x0100		Right Shift


********************************************************************************
	Language
********************************************************************************
By now there is only two languages supported (because I found nobody to
translate to other languages!) which are French and English. It is possible to
add easily German or any language: you must make a new language folder in the
SYS directory, a new RSC file and minor modifications in EGlib sources. If you
want to add a language support, contact me please.


********************************************************************************
	Windows
********************************************************************************
EGlib use enhanced GEM windows. The windows are used with an array of struct
containing all the parameters.

WIN struct:
===========
WSTR		str;							W	This is an union depending of type of win
int		in;							W	Memory index (for swap file)
int		smallflag;					R	SMALL flag
int		xslidpos,xslidlen;		W	Position & lenght of X slider
int		yslidpos,yslidlen;		W	Position & lenght of Y slider
int		x,y,w,h;						W	dimension free for the user
int		handle;						R	AES handle of the window
int		gadget;						R	Gadgets
int		type;							R	Type of window
int		id;							R	Identification of window
int		xwind;						R	X pos of the window
int		ywind;						R	Y pos of the window
int		wwind;						R	W pos of the window
int		hwind;						R	H pos of the window
int		xfull;						R	X full pos of the window
int		yfull;						R	Y full pos of the window
int		wfull;						R	W full pos of the window
int		hfull;						R	H full pos of the window
int		xwork;						R	X work pos of the window
int		ywork;						R	Y work pos of the window
int		wwork;						R	W work pos of the window
int		hwork;						R	H work pos of the window
int		wmini;						R	minimum width
int		hmini;						R	minimum height
int		xsmall,xwsmall;			R	X iconified win/work pos
int		ysmall,ywsmall;			R	Y iconified win/work pos
int		wsmall,wwsmall;			R	W iconified win/work pos
int		hsmall,hwsmall;			R	H iconified win/work pos
int		popup;						R	RSC tree index of PopUp Menu object
int		ic_tree;						R	RSC tree number of ICONIFIED window
int		icon;							R	RSC object index of ICONIFIED window
char		name[wNAMEMAX+2];			R	Name of the window
char		sname[wSNAMEMAX+2];		R	Name of the iconified window
char		help[14];					R	Name of the help file
void	cdecl (*init)(int i)
void	cdecl (*redraw)(int i,int x,int y,int w,int h)
void	cdecl (*top)(int i)
void	cdecl (*pop)(int i,int n)
void	cdecl (*close)(int i)
void	cdecl (*full)(int i)
void	cdecl (*arrow)(int i,int type)
void	cdecl (*hslid)(int i,int size)
void	cdecl (*vslid)(int i,int size)
void	cdecl (*size)(int i,int w,int h)
void	cdecl (*move)(int i,int x,int y)
void	cdecl (*untop)(int i)
void	cdecl (*ontop)(int i)
void	cdecl (*small)(int i)
void	cdecl (*nsmall)(int i)
void	cdecl (*clic)(int i,int x,int y,int k,int nb)
void	cdecl (*keybd)(int i,int key)

Icons for win:
==============
For iconified window you can use several sorts of icons:
WIC_EXT:
	No icon; the redraw function will be called.
WIC_DEF:
	The EGlib default icon
WIC_INF:
WIC_MEM:
WIC_FNT:
WIC_OPT:
WIC_SYS:
WIC_HLP:
	The EGlib intern icons
Or a positive number will be an icon in the application RSC.

Types of win:
=============
The following types for win are currently reserved. Please contact me to add
new types.
	TW_FORM	0		Form		(intern)
	TW_HELP	1		Help		(intern)
	TW_IMG	2		Image

Gadgets for win:
================
	wMODAL		Modal window
	wMOVE			Move window
	wCLOSE		Close window
	wMENU			PopUp menu on the window
	wCYCLE		Cycle window
	wICON			Iconifie window
	wFULL			Full window
	wVSLIDE		Vertical slider
	wUARROW		Up arrow
	wDARROW		Down arrow
	wSIZE			Resize window
	wRARROW		Right arrow
	wLARROW		Left arrow
	wHSLIDE		Horizontal slide
	wXWORK16		Force xwork pos 16 multiple
	wSWAP			Swap into file when icon


********************************************************************************
	HELP files
********************************************************************************
Help files are common ASCII files. Commands are entered with the '' code:
	
	-	0[TXT]											0Aide Principale sur le logiciel
	window title
	max lenght: GLB_WNAMEMAX.

	-	1[TXT]											1Aide Principale
	subject name (for historic)
	max lenght: MAX_LEN_HIST

	-	f[TEXT]										fPark Avenue
	Change the font.
	f					activate the defaut font
	fSystem Font		activate the defaut font

	-	h[{*}{/}N]									h*2 or h/3
	Change the font size.
	h activate the default size

	-	c[N]											c2
	Change the text color.
	c activate the default color.

	-	e[N]											e4
	Change the text effects:
		-	0x01:	TXT_THICKENED	(bold)
		-	0x02:	TXT_LIGHT		(light)
		-	0x04:	TXT_SKEWED		(skew)
		-	0x08:	TXT_UNDERLINED	(underline)
		-	0x10	TXT_OUTLINED	(outline)
		-	0x20	TXT_SHADOWED	(shadow)

	-	j[N]											j50
	Justification for carrige return

	-	k[N]											k80
	Justification for a paragraph begining

	-	d[N]											d50
	Set the tabulation size in pixel

	-	s[TXT1][TXT2]u							DISK.HLPFonctions Disquesu
	Define a new entry (branch to an other file)

	-	t
	Tabulation


********************************************************************************
	FUNCTIONS: EG_MAIN
********************************************************************************
int _initEGlib(char *name,void cdecl (*lFileIni)())
	This function is the first called to init EGlib. <name> is the name of the
	program (8 char max) for the LOG/INI/folder name in the SYS folder.

void _EGlib(void)
	Call the EGlib function.

int _rcIntersect(GRECT *p1,GRECT *p2)
	This funtion returns in p2 the intersection of two rectangles.

void _setClip(int flag,GRECT *area)
	This function sets or unsets the a clipping.

void _loadPal(int n)
	This function puts the previous saved palette (if glb.opt.pal==TRUE) only n
	first colors.

int _word(int val)
	This function returns the number of 16 bits words, usefull for vro_cpyfm().

void _EGlibPop(void)
	This function calls the EGlib PopUp.

void _reportLog(void)
	This function writes in the LOG file the text in glb.div.log


********************************************************************************
	FUNCTIONS: EG_AES
********************************************************************************
void _menuBar(int obj,int flag)
	Put or remove the <obj> menu bar.

int _StdKey(int shift,int key)
	Transforms a shift and scan/ascii code to a standard key.

void _clearAesBuffer(void)
	This function reads and handles all the GEM event buffer.

void _mousework(void)
	This function changes the mouse pointer to show that there is a work in
	progress.


********************************************************************************
	FUNCTIONS: EG_FSEL			(Selectric support!)
********************************************************************************
int _fexist(char *name,int type)
	This function returns TRUE if the file/folder exists.
	To search a folder type must be FA_SUBDIR, for a file type is 0.

int _fselect(char *pfname, char *pname, char *fname, char *ext, char *title)
	This function calls the fileselector. You can fill <pfname>, <pname> or
	<fname> as your choice. <ext> is a file mask like "IMAG*.PI?" and <title> a
	string to display at the top fileselect box.

int _slctCheck(uint version)
	This function checks if there is a Slectric <version>.

int _slctExtPath(int ext_num,char *(*ext)[],int path_num,char *(*paths)[])
	This function installs the default path or extensions in Slectric. You
	can transmit -1 to ext_num/path_num to keep them.

int _slctMoreNames(int mode,int num,void *str)
	I don't know what is the purpose of this function !

int _slctFirst(DTA *mydta,int attr)
int _slctNext(DTA *mydta)
int _slctRelease(void)
	This 3 functions work like Fsfirst() and Fsnext() !
	After treatment, call _slctRelease().


********************************************************************************
	FUNCTIONS: EG_MEM
********************************************************************************
int _mAlloc(long len,int type,int cls)
	This is to alloc a memory bloc of <len> bytes lenght. There is two types
	of blocs: MB_NORM is a normal bloc that can be moved in memory; MB_NOMOVE
	that must be used only if the bloc must not be moved.
	If <cls> is not NULL then the bloc will be erased.

void _mFree(int index)
	This free the <index> memory bloc.

void _mSpecFree(long adr)
	This is to free a MB_NOMOVE type bloc with its adress.

int _mDim(int index,long len,int cls)
	This is to change the size of a memory bloc.
	If <len> is greater than the actual bloc sie and <cls> not NULL then the
	upper part of bloc will be erased.

void *_Malloc(long number)
int _Mfree(void *block)
int _Mshrink(int zero,void *block,long newsiz)
	This is 3 functions are the standard GEMDOS functions; but modified to
	work in Accessory mode.


********************************************************************************
	FUNCTIONS: EG_POP
********************************************************************************
int _formMenu(OBJECT *tree,int obj,OBJECT *menu,int hJust,int vJust,int Video)
	This function handles a PopUp menu; attached at <tree>/<obj>, the popup
	tree is <menu> (composed of string or anything else); hJust & vJust are
	-1, 0 or +1 for the justification; Video draw in inverse mode <obj>.

int _popUp(OBJECT *menu,int x,int y)
	This is the same function as above but it allows to position the menu
	anywhere on the screen.

int _formXmenu(OBJECT *tree,int obj,char *tab,int nmb,int off,int len,int val)
	This is the extended scrolling PopUp. <tree> and <obj> is the object that
	calls the PopUp.
	This function works with an array of string. <tab> is a pointer on the
	first string, <nmb> is the number of entries, <off> is an offset of non-used
	bytes, <len> is the string lenght and val the default value.

void _initPopUp(OBJECT *tree,int obj,int popTree,int val)
	This function inits a PopUp menu <tree/obj> with the <popTree> Tree object
	with the <val> object.

void _initXPopUp(OBJECT *tree,int obj,char *tab,int nmb,int off,int len,int val)
	This function inits a PopUp menu <tree/obj> with a list of string.
	<tab> is a pointer to the list
	<nmb> is the number of lines in the list
	<off>	is the offset between the pointer and the begin of the text
	<len> is the len of one line
	<val> is the line number of the default.

int _getPopUp(OBJECT *tree,int obj)
	Returns the value selected in a [extended] PopUp menu.


********************************************************************************
	FUNCTIONS: EG_RSC
********************************************************************************
int _loadRSC(RSC *rsc)
	Load a RSC file (name is in the RSC struct), relocate it, init the userdef.

void _unloadRSC(RSC *rsc)
	Free a RSC file.

void _obPutStr(OBJECT *tree,int objc,const char *str)
	This functions copy <str> string in <tree>/<objc> and works with the TEXT,
	BOXTEXT, BUTTON, STRING, ICON and CICON objects (USERDEFs or not).

void _putPath(OBJECT *tree,int n,int len,char *name)
	This is the same function that above but don't work on ICON/CICON, limits
	the copy at <n> characters and adds "..." at the begin if <name> is longer
	than <n>.

char *_obGetStr(OBJECT *tree,int objc)
	This functions returns a pointer on the text of an object.

int _father(OBJECT *tree,int child)
	This function return the father number of an object or -1.

void _coord(OBJECT *tree,int obj,int larg,int *x,int *y,int *w,int *h)
	This function returns the object coordinates. If larg==TRUE then returns
	a bigger rectangle.

void _initNum(OBJECT *tree,int obj,uint vmin,uint vmax,uint inc,uint val)
	This function inits a Num object <tree/obj>:
	<vmin> is the minimal value.
	<vmax> is the maximal value.
	<inc> is the value of the increment.
	<val> is the default value.


********************************************************************************
	FUNCTIONS: EG_SYS
********************************************************************************
void	_outINI		(char *txt)
	This function outputs text in the INI file


********************************************************************************
	FUNCTIONS EG_WFRM
********************************************************************************
void _winObdraw(int i,OBJECT *tree,int obj,int dept,int x,int y,int w,int h)
	This function is used to redraw a specific object in the <i> form window.

int _winForm(int tree,char *name,char *sname,char *help,int popup,int icon)
	This is to open a form window; with object <tree>, <name> and <sname> win's
	name; <help> is the associated help file (without extension); <popup> the
	associated PopUp tree number; and <icon> the tree number for iconified
	window.
	BEWARE: <icon> must follows this rules:
		OBJECT 1 is a TEXT of wSNAMEMAX letters
		OBJECT 2 is a color icon

void _whichEdit(int i,int *obj,int *pos)
	This function returns the object currently edited (in a FORM window) and the
	position of the cursor.

void _setEdit(int i,int obj,int pos)
	This function sets the object to be edited (in a FORM window) and
	the cursor position (0xFF means end of line!)


********************************************************************************
	FUNCTIONS: EG_WIN
********************************************************************************
int _winOpen(window *win)
	Open a window and return the index.

void _winClose(int i)
	Close a window.

void _winVslid(int i)
void _winHslid(int i)
	Construct window slider.

void _winSmall(int i)
	Small a window.

void _winName(int i,char *name,char *sname)
	Change the name.

void _winWsize(int i,int w,int h)
void _winSize(int i,int w,int h)
	Change the size of a window.

void _winMove(int i,int x,int y)
	Change the window size.

int _winFindWin(int handle)
int _winFindId(int type,int id,int open)
	Find the EGlib index of a window.

void _winRedraw(int i,int x,int y,int w,int h)
	Redraw a window.

void _winCalc(int type,int kind,int x,int y,int w,int h,int *outx,int *outy,int *outw,int *outh)
	Calculate the Border or Window position like wind_calc().


********************************************************************************
	FUNCTIONS: EG_ASM
********************************************************************************
void _cls(long adr,long len)
	This function clears a portion of memory.

long _cookie(long Cook)
	This function returns a cookie value or 0 if it is not exist.

long _cookieJar(void)
	This function returns the cookie-jar adress.

int _vTOS(void)
	This function returns the TOS version.

int _getBoot(void)
	This function returns the boot drive.

long _LONG(long adr)
int _CARD(long adr)
char _BYTE(long adr)
	This three functions return the long word, word or byte at <adr> in
	supervisor mode.


********************************************************************************
	FUNCTIONS: EG_MOVE
********************************************************************************
void _bmove(long a,long,long l)
	This function move a portion of memory.
