/* OpenAmiga.org
 *  This file is part of the OpenAmiga "xfdmaster library project"
 *
 * For more information look at:
 *   http://openamiga.org/?function=viewproject&projectid=67
 */

/****************************************************************************
*   XFD library system for cruncher handling
*   Copyright (C) 1994-1998 by Georg Hörmann
*   Copyright (C) 1998 by Dirk Stöcker <soft@dstoecker.de>
*   Copyright (C) 2014 by Fredrik Wikström <fredrik@a500.org>
*
*   This library is free software; you can redistribute it and/or
*   modify it under the terms of the GNU Lesser General Public
*   License as published by the Free Software Foundation; either
*   version 2.1 of the License, or (at your option) any later version.
*
*   This library 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
*   Lesser General Public License for more details.
*
*   You should have received a copy of the GNU Lesser General Public
*   License along with this library; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
****************************************************************************/

#ifndef XFDMASTER_INTERNAL_H
#define XFDMASTER_INTERNAL_H

//#define DEBUG

#define __NOLIBBASE__
#define __NOGLOBALIFACE__

#include <libraries/xfdmaster.h>
#include <exec/emulation.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/utility.h>
#include <proto/elf.h>

#ifdef DEBUG
#define GET_SYSBASE (*(struct ExecBase **)4)
#define GET_IEXEC ((struct ExecIFace *)GET_SYSBASE->MainInterface)
#define DEBUGF(...) GET_IEXEC->DebugPrintF(__VA_ARGS__)
#else
#define DEBUGF(...)
#endif

#include "memio.h"

typedef BOOL (*xfdAnalyseFunc)(struct xfdMasterIFace *, APTR, struct xfdLinkerInfo *);
typedef BOOL (*xfdUnlinkFunc)(struct xfdMasterIFace *, struct xfdLinkerInfo *);

static const uint32 XfdMinLinkSize = 20+20+0x144+16+44+16;

/* Diz linker */
extern xfdAnalyseFunc LB_AnalyseDiz;
extern xfdUnlinkFunc LB_UnlinkDiz;
extern CONST_STRPTR LB_NameDiz;

/* xfdmaster.c */
void SetupInternal(struct xfdMasterBase *libBase);
void LoadExternal(struct xfdMasterBase *libBase);
APTR xfdGetHunk(struct xfdMasterBase *libBase, APTR buffer, LONG length, LONG num);

#endif

