/*
** ppc.library emulation
** (c)1998-99 Frank Wille <frank@phoenix.owl.de>
**
** Print error messages in Intuition Requesters
**
** V0.1  (15.11.1998) phx
**       First partially working ppc.library emulation. Synchronous PPC
**       tasks, started by runelf, which only use the basic PowerUp kernel
**       functions for I/O, memory and context-switch seem to work fine.
** V0.0  (01.11.1998) phx
**       created
*/

#include "ppclibemu.h"
#include <intuition/intuition.h>
#include <proto/intuition.h>


static void show_requester(struct PPCLibBase *,char *,APTR);



void error1(struct PPCLibBase *ppcbase,char *txt,...)
/* pops up a high priority error requester, which can't be disabled */
{
  va_list vl;

  va_start(vl,txt);
  show_requester(ppcbase,txt,(APTR)vl);
  va_end(vl);
}


void error2(struct PPCLibBase *ppcbase,char *txt,...)
/* pops up a normal error requester */
{
  if (ppcbase->Flags & PPCLibF_AllErrors) {
    va_list vl;

    va_start(vl,txt);
    show_requester(ppcbase,txt,(APTR)vl);
    va_end(vl);
  }
}


static void show_requester(struct PPCLibBase *ppcbase,char *txt,APTR args)
{
  struct EasyStruct es;

  es.es_StructSize = sizeof(struct EasyStruct);
  es.es_Flags = 0;
  es.es_Title = (UBYTE *)ppcbase->libnode.lib_Node.ln_Name;
  es.es_TextFormat = (UBYTE *)txt;
  es.es_GadgetFormat = (UBYTE *)"Ok";
  __EasyRequestArgs(NULL,&es,NULL,args,ppcbase->IntuitionBase);
}
