/*
***************************************************************************
*
* Datei:
*	  RSysGlobal.c
*
* Inhalt:
*
*      --- Globale Routinen ---
*
*
*      --- Lokale  Routinen ---
*
*
* Bemerkungen:
*	  Globale Daten für RSys (Flags, Menus etc.)
*
* Erstellungsdatum:
*	  07-Jul-93 	Rolf Böhme
*
* Änderungen:
*	  07-Jul-93 	Rolf Böhme	  Erstellung
*
***************************************************************************
*/

#include "RSys.h"

struct Library *DiskfontBase				= NULL;
struct Library *AslBase 					= NULL;
struct Library *GadToolsBase				= NULL;
struct Library *UtilityBase				= NULL;
struct Library *CxBase						= NULL;
struct Library *IFFParseBase				= NULL;
struct Library *IconBase					= NULL;

struct WorkbenchBase *WorkbenchBase 	= NULL;
struct IntuitionBase *IntuitionBase 	= NULL;
struct GfxBase *GfxBase 					= NULL;
struct ExpansionBase *ExpansionBase 	= NULL;
struct AmigaGuideBase *AmigaGuideBase	= NULL;

struct ExecBase *SysBase;
struct DosLibrary *DOSBase;

UBYTE namebuffer[MAXPUBSCREENNAME + 1] = (UBYTE *) "Workbench",
		autocon[MAXFULLNAME];

char _fullpath[MAXFULLNAME];

struct List ListeLVList;

struct Screen *Scr = NULL;
APTR	VisualInfo = NULL;
struct Window *SysWnd = NULL;
struct Gadget *SysGList = NULL;
struct Menu *SysMenus = NULL;
UWORD SysZoom[4];
struct Gadget *SysGadgets[20];
UWORD SysLeft = 153;
UWORD SysTop = 30;
UWORD SysWidth = 487;
UWORD SysHeight = 183; /*173*/
UBYTE *SysWdt = (UBYTE *) NAME " " VERSION " (" DATE ", " TIME ")";
struct TextAttr *Font;
UWORD FontX,
		FontY;
UWORD OffX,
		OffY;
struct TextAttr TAttr;
struct TextAttr Topaz80 =
{
	(STRPTR) "topaz.font", TOPAZ_EIGHTY, FS_NORMAL, FPF_ROMFONT
};

struct MsgPort *SysIdPort;

ScrollEntry *Entries = NULL;

EntryAttribute EntryAttr[]=
{
	/* 00 */ {"Task", 						 "Address  Taskname            Typ  Pri Stack Stat Cli",  "%08lx %-18.18s %4.4s %4ld %5ld %4.4s %3.3s",		MakeTaskList,				1	 },
	/* 01 */ {"Library", 					 "Address  Libraryname               Version  OpenCnt O",  "%08lx %-24s %4ld.%-4ld %7ld %lc", 					MakeLibList,				1	 },
	/* 02 */ {"Memory",						 "Memory address     Size    Type", 				 "%08lx     %10ld %s",								MakeMemoryList,			0	 },
	/* 03 */ {"Port", 						 "Address  Portname               Signal-Task      Pri",  "%08lx %-22s %-15s %4ld", 								MakePortList,				1	 },
	/* 04 */ {"Volume",						 "Volumename   K-Free K-Used %Used F Sta Typ",	 "%-12.12s %6ld %6ld %4ld%% %lc %3.3s %4.4s",MakeVolumeList,			1	 },
	/* 05 */ {"Assign",						 "Assign        Directory",							 "%-13.13s %-39.39s",								MakeAssignList,			1	 },
	/* 06 */ {"Font", 						 "Address  Fontname             Typ    Y   X Low Upp",	 "%08lx %-20s %-4s %3ld %3ld %3ld %3ld",				MakeFontList,				1	 },
	/* 07 */ {"Resource",					 "Address  Resourcename                Version  OpenCnt",  "%08lx %-26.26s %4ld.%-4ld %6ld",						MakeResList,				1	 },
	/* 08 */ {"Interrupt",					 "Address  Interruptname         Pri   Data     Code",	 "%08lx %-20.20s %4ld %08lx %08lx", 					MakeIntrList,				1	 },
	/* 09 */ {"Window",						 "Address  Windowtitle         H   W   X   Y Screen", 	 "%08lx %-17.17s %3ld %3ld %3ld %3ld %-10.10s", 	MakeWindowList,			1	 },
	/* 10 */ {"Screen",						 "Address  Screentitle               H   W   X   Y Typ",  "%08lx %-23.23s %3ld %3ld %3ld %3ld %3.3s", 		MakeScreenList,			1	 },
	/* 11 */ {"Input Handler", 			 "Address  Inputhandler name     Pri   Data     Code",	 "%08lx %-20.20s %4ld %08lx %08lx", 					MakeHandlerList,			1	 },
	/* 12 */ {"System Infos",				 "                      Systeminfo", 					 NULL,													MakeSystemList,			0	 },
	/* 13 */ {"Hardware Infos",			 "                  Hardware/Expansion",				 NULL,													MakeHardwareList, 		0	 },
	/* 14 */ {"Online Help",				 "                     Online Help",					 NULL,													NULL, 						0	 },
	/* 15 */ {"Preferences",				 "                     Preferences",					 NULL,													SysPrefList,				0	 },
	/* 16 */ {"Devices/Handler",			 "Device name   Driver/Handler", 					 "%-13.13s %-28.28s",								SysResidentList,			1	 },
	/* 17 */ {"Diskfonts",					 "Font name            Type   Y Style",			 "%-20.20s %-4.4s %3ld %10.10s", 				SysAvailFontsList,		1	 },
	/* 18 */ {"ENV:-List",					  "ENV-Variable  Content", 							  "%-13.13s %-28.28s",								 SysEnvList,				 1   },
	/* 19 */ {"CLI-List",					 "Address  CLI nr. Name             Pri  Stack",			 "%08lx CLI %-3ld %-15.15s %4ld %6ld", 				SysCLIList, 				1	 },
	/* 20 */ {"Resident Program", 		"Address  Resident name    UseCount  Type",					"%08lx %-20.20s %4ld %-14.14s",						  SysResidentProg,		  1	},
	/* 21 */ {"Semaphore",					 "Address  Semaphore name          Pri Ownertask", 		 "%08lx %-22.22s %4ld %-12.12s", 						SysSemaphoreList, 		1	 },
	/* 22 */ {"System vector", 			 "                   System Vectors",					 NULL,													SysVectorList, 			0	 },
	/* 23 */ {"Software Device",			 "Address  Devicename                  Version  OpenCnt",  "%08lx %-26.26s %4ld.%-4ld %6ld",						SysSoftDeviceList,		1	 },
	/* 24 */ {"Public Screen", 			 "Address  Name              VCnt SigTask",		          "%08lx %-18.18s %3ld %-9.9s",					SysPubScreenList, 		1	 },
	/* 25 */ {"Blitter Waiter",			 "Address  Name                 Prio", 						 "%08lx %-20.20s %3ld", 									SysBlitterWaitList,		1	 },
	/* 26 */ {"TOF Waiter", 				 "Address  Name                 Prio", 						 "%08lx %-20.20s %3ld", 									SysTOFWaitList,			1	 },
	/* 27 */ {"Commodity",					 "Address  Name                 Prio",							 "%08lx %-20.20s %3ld", 									SysBrokerList, 			1	 },
	/* 28 */ {"Printer data",				 "                    Printer data",					          NULL,													SysExtPrinterData,		0	 },
	/* 29 */ {"Library offsets",			 "Offs Address  Act Function",                            "%4ld %08lx %3s %-22.22s" , 					   SysCheckOffs,           0   },
	/* 30 */ {"Available Display Modes", "Address  Name              Depth   MinR      MaxR", 	 "%08lx %-17.17s  %3ld  %4ld,%-4ld %4ld,%-4ld", 	RSysGetDisplayModes, 	1	 },
	/* 31 */ {"Volume locks",				 "Address  File                                Access ",  "%08lx %-35.35s  %-5s",									RSysLockList,				1	 },
	/* 32 */ {"Amigaguide XRef",			 "Address  XRef keyword   Type File           Line",		 "%08lx %-14.14s %4.4s %-15.15s %4ld", 				RSysAmigaGuideRefList,	1	 },
	/* 33 */ {"Gadgets", 					 "Address  Gadget text    Typ    PosX PosY    W    H",	 "%08lx %-14.14s %6.6s %4ld %4ld %4ld %4ld", 		RSysGadgetList,			0	 },
	/* 34 */ {"Memory areas", 				 "Startadr Endadr   Attributes  Comment",                  "%08lx %08lx %3.3s %3.3s %3.3s %-22.22s", 		RSysMemoryAreaList,			1	 },
	/* 35 */ {"Fault codes", 				 "Fault  Message",                                        "%3ld   %-50.50s", 		                        RSysFaultMessages,			1	 },
};

struct _flags Flags =
{
	1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1,

/* RSys private */
	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

/* Dummys */
   0, 0, 0, 0, 0
};

int	countentries;
int	topentry;

int	LastID = SYSTEMINFO;

int ReopenWindow = FALSE;

int bpc = 0, bgc = 0;
long bpp = 0x00000000L;
int winddetail = 0,windblock = 1,menudetail = 0;
int iconx = NO_ICON_POSITION, icony = NO_ICON_POSITION;
int listviewheight = 10;
char *RSysName = NULL;

const char *field[] = {
	"-",
	"<no id>",
	"<no flags>",
	"<no task>",
	"<no node>",
	"<wrong type: %ld>",
	"<??>",
	"<no title>",
	"<no baudrate>",
	"<no parity>",
	"<no handshk>",
	"<no handler>",
	"<no file>",
	"<no lock>",
	" ",
   "<no FD-Offsets>",
   "<has image>",
   "<unknown>"
};

RSYSFILES RSysFiles =
{
   (UBYTE *)"PROGDIR:" NAME "Hardware.DAT",
   (UBYTE *)"PROGDIR:" NAME "LibOff.DAT",
   (UBYTE *)"PROGDIR:" NAME "13.guide",
   (UBYTE *)"PROGDIR:" NAME "13.guide.context",
   (UBYTE *)"PROGDIR:" NAME "Action.dat"
};

