#ifndef WALLSTREET_H
#define WALLSTREET_H
/*
 *	WALLSTREET.H
 *
 *	(C) Copyright 1995 Jaba Development.
 *	(C) Copyright 1995 Jan van den Baard.
 */

#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/commodities.h>
#include <libraries/gadtools.h>
#include <libraries/bgui.h>
#include <libraries/bgui_macros.h>
#include <devices/timer.h>
#include <workbench/startup.h>

#include <clib/alib_protos.h>

#include <proto/exec.h>
#include <proto/bgui.h>
#include <proto/commodities.h>
#include <proto/intuition.h>
#include <proto/dos.h>

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "WallStreet_rev.h"

/*
 *	For DICE it's "MakeProto" tool which
 *	automatically generates a prototypes
 *	header included at the end of this
 *	file.
 */
#define Prototype		extern

/*
 *	Object ID's
 */
#define ID_BROKERLIST		1
#define ID_SHOW                 2
#define ID_HIDEBROKERS		3
#define ID_ACTIVE		4
#define ID_REMOVE		5
#define ID_HIDE                 6
#define ID_QUIT                 7
#define ID_ABOUT		8

/*
 *	Broker hotkey.
 */
#define CXK_SHOW		1

/*
 *	Compiler muck.
 */
#ifdef _DCC
#define SAVEDS __geta4
#define ASM
#define REG(x) __ ## x
#else
#define SAVEDS __saveds
#define ASM __asm
#define REG(x) register __ ## x
#endif

/*
 *	Arguments interface.
 */
#define SHELL		"CX_PRIORITY/K/N,CX_POPUP/K,CX_POPKEY/K,PUBSCREEN/K"

struct Args {
	LONG		*Pri;
	UBYTE		*Popup;
	UBYTE		*Popkey;
	UBYTE		*PubScreen;
};

#define sArgInt(s,d)	 s ? *( s ) : d
#define sArgStr(s,d)	 s ? s : d

/*
 *	The following stuff is based on undocumented
 *	commodities.library stuff. Don't be supprised
 *	if this stuff breaks on future OS's (if they
 *	ever see the light of day...)
 *
 *	Information stolen from the various Exchange clones :)
 */
#pragma libcall CxBase FindBroker 6c 801
#pragma libcall CxBase CopyBrokerList ba 801
#pragma libcall CxBase FreeBrokerList c0 801
#pragma libcall CxBase BrokerCommand c6 802

CxObj *FindBroker( UBYTE * );
LONG CopyBrokerList( struct List * );
LONG FreeBrokerList( struct List * );
LONG BrokerCommand( UBYTE *, LONG );

struct BrokerCopy {
	struct Node		bc_Node;
	UBYTE			bc_Name[ CBD_NAMELEN ];
	UBYTE			bc_Title[ CBD_TITLELEN ];
	UBYTE			bc_Descr[ CBD_DESCRLEN ];
	LONG			bc_Task;
	LONG			bc_Dummy1;
	LONG			bc_Dummy2;
	UWORD			bc_Flags;
};

#define COF_ACTIVE		2

/*
 *	The data constructed from the BrokerCopy
 *	structure in the listview resource hook.
 */
struct ListBroker {
	UBYTE			lb_PreParse[ 3 ];
	UBYTE			lb_Name[ CBD_NAMELEN ];
	UBYTE			lb_Title[ CBD_TITLELEN ];
	UBYTE			lb_Descr[ CBD_DESCRLEN ];
	LONG			lb_Task;
	UWORD			lb_Flags;
	ULONG			lb_BuildCount;
};

/*
 *	As generated by "MakeProto".
 */
#include "WallStreet_protos.h"

#endif
