/*
** $PROJECT: class library template
**
** $VER: classbase.h 40.4 (19.08.97)
**
** $AUTHOR: Stefan Ruppert , Windthorststrasse 5 , 65439 Floersheim , GERMANY
**
** $COPYRIGHT: (C) Copyright 1996,1997 by Stefan Ruppert, All Rights Reserved!
**
** $EMAIL: ruppert@amigaworld.com
**
** $HISTORY:
**
** 19.08.97 : 040.004 : now only USE_LIB#? defines
** 04.08.97 : 040.003 : added NO_#?LIB defines
** 09.11.96 : 040.002 : now uses ClassLibrary structure from the DevCD
** 15.09.96 : 040.001 : + removed some unnecessary includes
**                      + added Semaphore structure to ClassBase
*/

/* ------------------------- include system stuff ------------------------- */

#include <exec/types.h>
#include <exec/ports.h>
#include <exec/memory.h>
#include <exec/lists.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/icclass.h>
#include <dos/dos.h>

#include <clib/macros.h>
#include <clib/alib_protos.h>
#include <clib/alib_stdio_protos.h>

#include <string.h>

/* ----------------------- compiler and class stuff ----------------------- */

#include "compiler.h"

#include "classdata.h"

/* ----------------------------- debug stuff ------------------------------ */

#include "debug.h"

/* ----------------------- needed system libraries ------------------------ */

#ifdef __GNUC__
#define __NOLIBBASE__
#endif

/* force SAS to use the SysBase pragmas instead of AbsSysBase pragmas */
#ifdef __SASC
#include <clib/exec_protos.h>
#include <pragmas/exec_sysbase_pragmas.h>
#else
#include <proto/exec.h>
#endif

#include <proto/intuition.h>
#include <proto/utility.h>

/* -------------------- include specific systems parts -------------------- */

#ifdef USE_GFXLIB
#include <proto/graphics.h>
#endif
#ifdef USE_IFFPARSELIB
#include <proto/iffparse.h>
#endif
#ifdef USE_DATATYPESLIB
#include <intuition/gadgetclass.h>
#include <datatypes/datatypes.h>
#include <datatypes/datatypesclass.h>
#include <proto/datatypes.h>
#endif
#ifdef USE_DOSLIB
#include <proto/dos.h>
#endif
#ifdef USE_LOCALELIB
#include <proto/locale.h>
#endif

/* ------------------------------ structures ------------------------------ */

#ifndef USERCLASSBASEDATA
#define USERCLASSBASEDATA
#endif

#ifndef USERCLASSBASEFUNCTABLE
#define USERCLASSBASEFUNCTABLE
#endif

struct ClassBase
{
   struct ClassLibrary cb_Lib;

   struct Library *cb_SysBase;
   struct Library *cb_IntuitionBase;
   struct Library *cb_UtilityBase;

#ifdef USE_DOSLIB
#define DOSBase                 cb->cb_DOSBase
   struct Library *cb_DOSBase;
#endif

#ifdef USE_GFXLIB
#define GfxBase                 cb->cb_GfxBase
   struct Library *cb_GfxBase;
#endif

#ifdef USE_DATATYPESLIB
#define DataTypesBase           cb->cb_DataTypesBase
   struct Library *cb_DataTypesBase;
#endif

#ifdef USE_IFFPARSELIB
#define IFFParseBase            cb->cb_IFFParseBase
   struct Library *cb_IFFParseBase;
#endif

#ifdef USE_LOCALELIB
#define LocaleBase              cb->cb_LocaleBase
   struct Library *cb_LocaleBase;
#endif

#ifdef SUPERCLASSLIBRARY
#define SuperClassBase          cb->cb_SuperClassBase
   struct Library *cb_SuperClassBase;
#endif

   BPTR cb_SegList;

   struct SignalSemaphore cb_Lock;

   USERCLASSBASEDATA
};

#define SysBase                 cb->cb_SysBase
#define UtilityBase             cb->cb_UtilityBase
#define IntuitionBase           cb->cb_IntuitionBase

#define CLASSBASE               struct ClassBase *cb = (struct ClassBase *) cl->cl_UserData

