/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3u-20010104-0041 (Alpha 5)
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

/***********************************************************************
 * common.swg
 *
 *     This file contains generic SWIG runtime support for pointer
 *     type checking as well as a few commonly used macros to control
 *     external linkage.
 *
 * Author : David Beazley (beazley@cs.uchicago.edu)
 *
 * Copyright (c) 1999-2000, The University of Chicago
 * 
 * This file may be freely redistributed without license or fee provided
 * this copyright message remains intact.
 ************************************************************************/

#include <string.h>

#if defined(_WIN32) || defined(__WIN32__)
#       if defined(_MSC_VER)
#               if defined(STATIC_LINKED)
#                       define SWIGEXPORT(a) a
#               else
#                       define SWIGEXPORT(a) __declspec(dllexport) a
#               endif
#       else
#               if defined(__BORLANDC__)
#                       define SWIGEXPORT(a) a _export
#               else
#                       define SWIGEXPORT(a) a
#       endif
#endif
#else
#       define SWIGEXPORT(a) a
#endif

#ifdef SWIG_GLOBAL
#define SWIGRUNTIME(a) SWIGEXPORT(a)
#else
#define SWIGRUNTIME(a) static a
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct swig_type_info {
  char  *name;                 
  void *(*converter)(void *);
  char  *str;
  struct swig_type_info  *next;
  struct swig_type_info  *prev;
} swig_type_info;

#ifdef SWIG_NOINCLUDE
SWIGEXPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
SWIGEXPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
SWIGEXPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
#else

static swig_type_info *swig_type_list = 0;

/* Register a type mapping with the type-checking */
SWIGRUNTIME(swig_type_info *)
SWIG_TypeRegister(swig_type_info *ti)
{
  swig_type_info *tc, *head, *ret, *next;
  /* Check to see if this type has already been registered */
  tc = swig_type_list;
  while (tc) {
    if (strcmp(tc->name, ti->name) == 0) {
      /* Already exists in the table.  Just add additional types to the list */
      head = tc;
      next = tc->next;
      goto l1;
    }
    tc = tc->prev;
  }
  head = ti;
  next = 0;

  /* Place in list */
  ti->prev = swig_type_list;
  swig_type_list = ti;

  /* Build linked lists */
 l1:
  ret = head;
  tc = ti + 1;
  /* Patch up the rest of the links */
  while (tc->name) {
    head->next = tc;
    tc->prev = head;
    head = tc;
    tc++;
  }
  head->next = next;
  return ret;
}

/* Check the typename */
SWIGRUNTIME(swig_type_info *) 
SWIG_TypeCheck(char *c, swig_type_info *ty)
{
  swig_type_info *s;
  if (!ty) return 0;        /* Void pointer */
  s = ty->next;             /* First element always just a name */
  while (s) {
    if (strcmp(s->name,c) == 0) {
      if (s == ty->next) return s;
      /* Move s to the top of the linked list */
      s->prev->next = s->next;
      if (s->next) {
	s->next->prev = s->prev;
      }
      /* Insert s as second element in the list */
      s->next = ty->next;
      if (ty->next) ty->next->prev = s;
      ty->next = s;
      return s;
    }
    s = s->next;
  }
  return 0;
}

/* Cast a pointer (needed for C++ inheritance */
SWIGRUNTIME(void *) 
SWIG_TypeCast(swig_type_info *ty, void *ptr) 
{
  if ((!ty) || (!ty->converter)) return ptr;
  return (*ty->converter)(ptr);
}

/* Search for a swig_type_info structure */
SWIGRUNTIME(void *)
SWIG_TypeQuery(const char *name) {
  swig_type_info *ty = swig_type_list;
  while (ty) {
    if (ty->str && (strcmp(name,ty->str) == 0)) return ty;
    if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
    ty = ty->prev;
  }
  return 0;
}

#endif

#ifdef __cplusplus
}
#endif



/* -----------------------------------------------------------------------------
 * perl5.swg
 *
 * Perl5 runtime library
 * $Header: /cvsroot/mgraph/Graph_wrap.c,v 1.1 2001/01/04 11:06:05 tridge Exp $
 * ----------------------------------------------------------------------------- */

#define SWIGPERL
#define SWIGPERL5
#ifdef __cplusplus
/* Needed on some windows machines---since MS plays funny
   games with the header files under C++ */
#include <math.h>
#include <stdlib.h>
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

/* Get rid of free and malloc defined by perl */
#undef free
#undef malloc

#include <string.h>
#ifdef __cplusplus
}
#endif

#ifdef PERL_OBJECT
#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
#define MAGIC_CAST   (int (CPerlObj::*)(SV *, MAGIC *))
#define SWIGCLASS_STATIC 
#else
#define MAGIC_PPERL
#define MAGIC_CAST
#define SWIGCLASS_STATIC static
#endif

#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
#endif

/* Modifications for newer Perl 5.005 releases */

#if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50))))
#ifndef PL_sv_yes
#define PL_sv_yes sv_yes
#endif
#ifndef PL_sv_undef
#define PL_sv_undef sv_undef
#endif
#ifndef PL_na
#define PL_na na
#endif
#endif

#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef SWIG_NOINCLUDE

#ifndef PERL_OBJECT
extern int SWIG_ConvertPtr(SV *, void **, swig_type_info *);
extern void SWIG_MakePtr(SV *, void *, swig_type_info *);
#else
extern int _SWIG_ConvertPtr(CPerlObj *, SV *, void **, swig_type_info *);
extern void _SWIG_MakePtr(CPerlObj *, SV *, void *, swig_type_info *);
#define SWIG_ConvertPtr(a,b,c) _SWIG_ConvertPtr(pPerl,a,b,c)
#define SWIG_MakePtr(a,b,c) _SWIG_MakePtr(pPerl,a,b,c)
#endif

#endif

/* Function for getting a pointer value */

#ifndef PERL_OBJECT
SWIGRUNTIME(int) 
SWIG_ConvertPtr(SV *sv, void **ptr, swig_type_info *_t)
#else
#define SWIG_ConvertPtr(a,b,c) _SWIG_GetConvert(pPerl,a,b,c)
SWIGRUNTIME(int)
_SWIG_ConvertPtr(CPerlObj *pPerl, SV *sv, void **ptr, swig_type_info *_t)
#endif
{
  char *_c;
  swig_type_info *tc;
  IV   tmp;

  /* If magical, apply more magic */
  if (SvGMAGICAL(sv))
    mg_get(sv);

  /* Check to see if this is an object */
  if (sv_isobject(sv)) {
    SV *tsv = (SV*) SvRV(sv);
    if ((SvTYPE(tsv) == SVt_PVHV)) {
      MAGIC *mg;
      if (SvMAGICAL(tsv)) {
	mg = mg_find(tsv,'P');
	if (mg) {
	  SV *rsv = mg->mg_obj;
	  if (sv_isobject(rsv)) {
	    tmp = SvIV((SV*)SvRV(rsv));
	  }
	}
      } else {
	return -1;
      }
    } else {
      tmp = SvIV((SV*)SvRV(sv));
    }
    if (!_t) {
      *(ptr) = (void *) tmp;
      return 0;
    }
  } else if (! SvOK(sv)) {            /* Check for undef */
    *(ptr) = (void *) 0;
    return 0;
  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
    *(ptr) = (void *) 0;
    if (!SvROK(sv)) 
      return 0;
    else
      return -1;
  } else {                            /* Don't know what it is */
      *(ptr) = (void *) 0;
      return -1;
  }
  if (_t) {
    /* Now see if the types match */      
    _c = HvNAME(SvSTASH(SvRV(sv)));
    tc = SWIG_TypeCheck(_c,_t);
    if (!tc) {
      *ptr = (void *) tmp;
      return -1;
    }
    *ptr = SWIG_TypeCast(tc,(void *)tmp);
    return 0;
  }
  *ptr = (void *) tmp;
  return 0;
}
#ifndef PERL_OBJECT
SWIGRUNTIME(void) 
SWIG_MakePtr(SV *sv, void *ptr, swig_type_info *t)
#else
#define SWIG_MakePtr(a,b,c) _SWIG_MakePtr(pPerl,a,b,c)
SWIGRUNTIME(int *)
_SWIG_MakePtr(CPerlObj *pPerl, SV *sv, void *ptr, swig_type_info *t)
#endif
{
  sv_setref_pv(sv, t->name, ptr);
}

/* Magic variable code */
#ifndef PERL_OBJECT
#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) {
#else
#define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
static void _swig_create_magic(CPerlObj *pPerl, SV *sv, char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) {
#endif
  MAGIC *mg;
  sv_magic(sv,sv,'U',name,strlen(name));
  mg = mg_find(sv,'U');
  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
  mg->mg_virtual->svt_get = get;
  mg->mg_virtual->svt_set = set;
  mg->mg_virtual->svt_len = 0;
  mg->mg_virtual->svt_clear = 0;
  mg->mg_virtual->svt_free = 0;
}

#ifdef __cplusplus
}
#endif







/* -------- TYPES TABLE (BEGIN) -------- */

#define  SWIGTYPE_p_int swig_types[0] 
static swig_type_info *swig_types[2];

/* -------- TYPES TABLE (END) -------- */

#define SWIG_init    boot_Graph

#define SWIG_name   "Graph::boot_Graph"
#define SWIG_varinit "Graph::var_Graph_init();"
#ifdef __cplusplus
extern "C"
#endif
#ifndef PERL_OBJECT
SWIGEXPORT(void) SWIG_init (CV* cv);
#else
SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
#endif

#ifndef PERL_OBJECT
#define swig_setiv(a,b) _swig_setiv(a,b)
static void _swig_setiv(char *name, long value) { 
#else
#define swig_setiv(a,b) _swig_setiv(pPerl,a,b)
static void _swig_setiv(CPerlObj *pPerl, char *name, long value) { 
#endif
     SV *sv; 
     sv = perl_get_sv(name,TRUE | 0x2);
     sv_setiv(sv, (IV) value);
     SvREADONLY_on(sv);
}

extern void StartGraphics(int ,int ,int );
extern void EndGraphics();
extern void DrawLine(int ,int ,int ,int );
extern void DrawRectangle(int ,int ,int ,int );
extern void DrawEllipse(int ,int ,int ,int );
extern void FillEllipse(int ,int ,int ,int );
extern void FillRectangle(int ,int ,int ,int );
extern void WaitForButtonPress();
extern void DrawPoint(int ,int );
extern void ClearWindow();
extern void FlushGraphics();
extern void DrawArc(int ,int ,int ,int ,int ,int );
extern void FillArc(int ,int ,int ,int ,int ,int );
extern void MousePosition(int *,int *);
extern void EventPosition(int *,int *);
extern int EventKeyCode();
extern void DrawString(int ,int ,char *);
extern void WaitForEvent(int );
extern int LastEvent();
extern int ScreenWidth();
extern int ScreenHeight();
extern int WindowWidth();
extern int WindowHeight();
extern int AvailableColors();
extern int StringHeight(char *);
extern int StringWidth(char *);
extern void LoadFont(char *);
extern void SetLineStyle(int );
extern void SetLineWidth(int );
extern void AlwaysFlush(int );
extern void SetDrawingFunction(int );
extern void SaveSettings();
extern void RestoreSettings();
extern unsigned int RandomCard();
extern void SetTitle(char *);
extern int GetColor(char *);
extern int GetColorRGB(int ,int ,int );
extern void SetForeground(int );
extern void SetBackground(int );
extern void DrawCircle(int ,int ,int );
extern void FillCircle(int ,int ,int );
extern void ClearArea(int ,int ,int ,int );
extern int LoadImage(char *);
extern int ImageWidth(int );
extern int ImageHeight(int );
extern void PlaceImage(int ,int ,int );
extern void Flush();
extern void RestoreImage(int );
extern void FreeImage(int );
extern void Sleep(double );
extern void Wait(double );
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_Graph_var::
class _wrap_Graph_var : public CPerlObj {
public:
#else
#define MAGIC_CLASS
#endif
SWIGCLASS_STATIC int swig_magic_readonly(SV *sv, MAGIC *mg) {
    MAGIC_PPERL
    sv = sv; mg = mg;
    croak("Value is read-only.");
    return 0;
}


#ifdef PERL_OBJECT
};
#endif

XS(_wrap_StartGraphics) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 3) || (items > 3)) 
    croak("Usage: StartGraphics(Width,Height,use_shadow);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    StartGraphics(arg0,arg1,arg2);
    XSRETURN(argvi);
}


XS(_wrap_EndGraphics) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: EndGraphics();");
    EndGraphics();
    XSRETURN(argvi);
}


XS(_wrap_DrawLine) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 4) || (items > 4)) 
    croak("Usage: DrawLine(x1,y1,x2,y2);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    DrawLine(arg0,arg1,arg2,arg3);
    XSRETURN(argvi);
}


XS(_wrap_DrawRectangle) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 4) || (items > 4)) 
    croak("Usage: DrawRectangle(x,y,width,height);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    DrawRectangle(arg0,arg1,arg2,arg3);
    XSRETURN(argvi);
}


XS(_wrap_DrawEllipse) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 4) || (items > 4)) 
    croak("Usage: DrawEllipse(x,y,width,height);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    DrawEllipse(arg0,arg1,arg2,arg3);
    XSRETURN(argvi);
}


XS(_wrap_FillEllipse) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 4) || (items > 4)) 
    croak("Usage: FillEllipse(x,y,width,height);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    FillEllipse(arg0,arg1,arg2,arg3);
    XSRETURN(argvi);
}


XS(_wrap_FillRectangle) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 4) || (items > 4)) 
    croak("Usage: FillRectangle(x,y,width,height);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    FillRectangle(arg0,arg1,arg2,arg3);
    XSRETURN(argvi);
}


XS(_wrap_WaitForButtonPress) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: WaitForButtonPress();");
    WaitForButtonPress();
    XSRETURN(argvi);
}


XS(_wrap_DrawPoint) {
    int arg0 ;
    int arg1 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 2) || (items > 2)) 
    croak("Usage: DrawPoint(x,y);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    DrawPoint(arg0,arg1);
    XSRETURN(argvi);
}


XS(_wrap_ClearWindow) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: ClearWindow();");
    ClearWindow();
    XSRETURN(argvi);
}


XS(_wrap_FlushGraphics) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: FlushGraphics();");
    FlushGraphics();
    XSRETURN(argvi);
}


XS(_wrap_DrawArc) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 6) || (items > 6)) 
    croak("Usage: DrawArc(x,y,width,height,angle1,angle2);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    arg4 = (int )SvIV(ST(4));
    arg5 = (int )SvIV(ST(5));
    DrawArc(arg0,arg1,arg2,arg3,arg4,arg5);
    XSRETURN(argvi);
}


XS(_wrap_FillArc) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 6) || (items > 6)) 
    croak("Usage: FillArc(x,y,width,height,angle1,angle2);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    arg4 = (int )SvIV(ST(4));
    arg5 = (int )SvIV(ST(5));
    FillArc(arg0,arg1,arg2,arg3,arg4,arg5);
    XSRETURN(argvi);
}


XS(_wrap_MousePosition) {
    int *arg0 ;
    int *arg1 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 2) || (items > 2)) 
    croak("Usage: MousePosition(x,y);");
    if (SWIG_ConvertPtr(ST(0),(void **) &arg0,SWIGTYPE_p_int) < 0) {
        croak("Type error in argument 1 of MousePosition. Expected %s", SWIGTYPE_p_int->name);
        XSRETURN(1);
    }
    if (SWIG_ConvertPtr(ST(1),(void **) &arg1,SWIGTYPE_p_int) < 0) {
        croak("Type error in argument 2 of MousePosition. Expected %s", SWIGTYPE_p_int->name);
        XSRETURN(1);
    }
    MousePosition(arg0,arg1);
    XSRETURN(argvi);
}


XS(_wrap_EventPosition) {
    int *arg0 ;
    int *arg1 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 2) || (items > 2)) 
    croak("Usage: EventPosition(x,y);");
    if (SWIG_ConvertPtr(ST(0),(void **) &arg0,SWIGTYPE_p_int) < 0) {
        croak("Type error in argument 1 of EventPosition. Expected %s", SWIGTYPE_p_int->name);
        XSRETURN(1);
    }
    if (SWIG_ConvertPtr(ST(1),(void **) &arg1,SWIGTYPE_p_int) < 0) {
        croak("Type error in argument 2 of EventPosition. Expected %s", SWIGTYPE_p_int->name);
        XSRETURN(1);
    }
    EventPosition(arg0,arg1);
    XSRETURN(argvi);
}


XS(_wrap_EventKeyCode) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: EventKeyCode();");
    result = (int )EventKeyCode();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_DrawString) {
    int arg0 ;
    int arg1 ;
    char *arg2 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 3) || (items > 3)) 
    croak("Usage: DrawString(x,y,str);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    if (! SvOK((SV*) ST(2))) {
        arg2 = 0; 
    }
    else {
        arg2 = (char *) SvPV(ST(2),PL_na); 
    }
    DrawString(arg0,arg1,arg2);
    XSRETURN(argvi);
}


XS(_wrap_WaitForEvent) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: WaitForEvent(event_mask);");
    arg0 = (int )SvIV(ST(0));
    WaitForEvent(arg0);
    XSRETURN(argvi);
}


XS(_wrap_LastEvent) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: LastEvent();");
    result = (int )LastEvent();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_ScreenWidth) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: ScreenWidth();");
    result = (int )ScreenWidth();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_ScreenHeight) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: ScreenHeight();");
    result = (int )ScreenHeight();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_WindowWidth) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: WindowWidth();");
    result = (int )WindowWidth();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_WindowHeight) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: WindowHeight();");
    result = (int )WindowHeight();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_AvailableColors) {
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: AvailableColors();");
    result = (int )AvailableColors();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_StringHeight) {
    char *arg0 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: StringHeight(s);");
    if (! SvOK((SV*) ST(0))) {
        arg0 = 0; 
    }
    else {
        arg0 = (char *) SvPV(ST(0),PL_na); 
    }
    result = (int )StringHeight(arg0);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_StringWidth) {
    char *arg0 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: StringWidth(s);");
    if (! SvOK((SV*) ST(0))) {
        arg0 = 0; 
    }
    else {
        arg0 = (char *) SvPV(ST(0),PL_na); 
    }
    result = (int )StringWidth(arg0);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_LoadFont) {
    char *arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: LoadFont(font_name);");
    if (! SvOK((SV*) ST(0))) {
        arg0 = 0; 
    }
    else {
        arg0 = (char *) SvPV(ST(0),PL_na); 
    }
    LoadFont(arg0);
    XSRETURN(argvi);
}


XS(_wrap_SetLineStyle) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: SetLineStyle(style);");
    arg0 = (int )SvIV(ST(0));
    SetLineStyle(arg0);
    XSRETURN(argvi);
}


XS(_wrap_SetLineWidth) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: SetLineWidth(width);");
    arg0 = (int )SvIV(ST(0));
    SetLineWidth(arg0);
    XSRETURN(argvi);
}


XS(_wrap_AlwaysFlush) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: AlwaysFlush(setting);");
    arg0 = (int )SvIV(ST(0));
    AlwaysFlush(arg0);
    XSRETURN(argvi);
}


XS(_wrap_SetDrawingFunction) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: SetDrawingFunction(fn);");
    arg0 = (int )SvIV(ST(0));
    SetDrawingFunction(arg0);
    XSRETURN(argvi);
}


XS(_wrap_SaveSettings) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: SaveSettings();");
    SaveSettings();
    XSRETURN(argvi);
}


XS(_wrap_RestoreSettings) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: RestoreSettings();");
    RestoreSettings();
    XSRETURN(argvi);
}


XS(_wrap_RandomCard) {
    int argvi = 0;
    unsigned int result ;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: RandomCard();");
    result = (unsigned int )RandomCard();
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_SetTitle) {
    char *arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: SetTitle(title);");
    if (! SvOK((SV*) ST(0))) {
        arg0 = 0; 
    }
    else {
        arg0 = (char *) SvPV(ST(0),PL_na); 
    }
    SetTitle(arg0);
    XSRETURN(argvi);
}


XS(_wrap_GetColor) {
    char *arg0 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: GetColor(name);");
    if (! SvOK((SV*) ST(0))) {
        arg0 = 0; 
    }
    else {
        arg0 = (char *) SvPV(ST(0),PL_na); 
    }
    result = (int )GetColor(arg0);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_GetColorRGB) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 3) || (items > 3)) 
    croak("Usage: GetColorRGB(red,green,blue);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    result = (int )GetColorRGB(arg0,arg1,arg2);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_SetForeground) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: SetForeground(color);");
    arg0 = (int )SvIV(ST(0));
    SetForeground(arg0);
    XSRETURN(argvi);
}


XS(_wrap_SetBackground) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: SetBackground(color);");
    arg0 = (int )SvIV(ST(0));
    SetBackground(arg0);
    XSRETURN(argvi);
}


XS(_wrap_DrawCircle) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 3) || (items > 3)) 
    croak("Usage: DrawCircle(x,y,radius);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    DrawCircle(arg0,arg1,arg2);
    XSRETURN(argvi);
}


XS(_wrap_FillCircle) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 3) || (items > 3)) 
    croak("Usage: FillCircle(x,y,radius);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    FillCircle(arg0,arg1,arg2);
    XSRETURN(argvi);
}


XS(_wrap_ClearArea) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 4) || (items > 4)) 
    croak("Usage: ClearArea(x,y,width,height);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    arg3 = (int )SvIV(ST(3));
    ClearArea(arg0,arg1,arg2,arg3);
    XSRETURN(argvi);
}


XS(_wrap_LoadImage) {
    char *arg0 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: LoadImage(fname);");
    if (! SvOK((SV*) ST(0))) {
        arg0 = 0; 
    }
    else {
        arg0 = (char *) SvPV(ST(0),PL_na); 
    }
    result = (int )LoadImage(arg0);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_ImageWidth) {
    int arg0 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: ImageWidth(i);");
    arg0 = (int )SvIV(ST(0));
    result = (int )ImageWidth(arg0);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_ImageHeight) {
    int arg0 ;
    int argvi = 0;
    int result ;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: ImageHeight(i);");
    arg0 = (int )SvIV(ST(0));
    result = (int )ImageHeight(arg0);
    ST(argvi) = sv_newmortal();
    sv_setiv(ST(argvi++),(IV) result);
    XSRETURN(argvi);
}


XS(_wrap_PlaceImage) {
    int arg0 ;
    int arg1 ;
    int arg2 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 3) || (items > 3)) 
    croak("Usage: PlaceImage(i,x,y);");
    arg0 = (int )SvIV(ST(0));
    arg1 = (int )SvIV(ST(1));
    arg2 = (int )SvIV(ST(2));
    PlaceImage(arg0,arg1,arg2);
    XSRETURN(argvi);
}


XS(_wrap_Flush) {
    int argvi = 0;
    dXSARGS;
    
    if ((items < 0) || (items > 0)) 
    croak("Usage: Flush();");
    Flush();
    XSRETURN(argvi);
}


XS(_wrap_RestoreImage) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: RestoreImage(i);");
    arg0 = (int )SvIV(ST(0));
    RestoreImage(arg0);
    XSRETURN(argvi);
}


XS(_wrap_FreeImage) {
    int arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: FreeImage(i);");
    arg0 = (int )SvIV(ST(0));
    FreeImage(arg0);
    XSRETURN(argvi);
}


XS(_wrap_Sleep) {
    double arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: Sleep(sec);");
    arg0 = (double )SvNV(ST(0));
    Sleep(arg0);
    XSRETURN(argvi);
}


XS(_wrap_Wait) {
    double arg0 ;
    int argvi = 0;
    dXSARGS;
    
    if ((items < 1) || (items > 1)) 
    croak("Usage: Wait(sec);");
    arg0 = (double )SvNV(ST(0));
    Wait(arg0);
    XSRETURN(argvi);
}



/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */

static swig_type_info _swigt__p_int[] = {{"_p_int", 0, "int *"},{"_p_int"},{0}};

static swig_type_info *swig_types_initial[] = {
_swigt__p_int, 
0
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

XS(_wrap_perl5_Graph_var_init) {
    dXSARGS;
    SV *sv;
    swig_setiv("Graph::eExpose", (long) (1L<<0));
    swig_setiv("Graph::eKeyPress", (long) (1L<<1));
    swig_setiv("Graph::eKeyRelease", (long) (1L<<2));
    swig_setiv("Graph::eButtonPress", (long) (1L<<3));
    swig_setiv("Graph::eButtonRelease", (long) (1L<<4));
    swig_setiv("Graph::eMotion", (long) (1L<<5));
    XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
XS(SWIG_init) {
    dXSARGS;
    int i;
    char *file = __FILE__;
    for (i = 0; swig_types_initial[i]; i++) {
        swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
    }
    newXS("Graph::var_Graph_init", _wrap_perl5_Graph_var_init, file);
    newXS("Graph::StartGraphics", _wrap_StartGraphics, file);
    newXS("Graph::EndGraphics", _wrap_EndGraphics, file);
    newXS("Graph::DrawLine", _wrap_DrawLine, file);
    newXS("Graph::DrawRectangle", _wrap_DrawRectangle, file);
    newXS("Graph::DrawEllipse", _wrap_DrawEllipse, file);
    newXS("Graph::FillEllipse", _wrap_FillEllipse, file);
    newXS("Graph::FillRectangle", _wrap_FillRectangle, file);
    newXS("Graph::WaitForButtonPress", _wrap_WaitForButtonPress, file);
    newXS("Graph::DrawPoint", _wrap_DrawPoint, file);
    newXS("Graph::ClearWindow", _wrap_ClearWindow, file);
    newXS("Graph::FlushGraphics", _wrap_FlushGraphics, file);
    newXS("Graph::DrawArc", _wrap_DrawArc, file);
    newXS("Graph::FillArc", _wrap_FillArc, file);
    newXS("Graph::MousePosition", _wrap_MousePosition, file);
    newXS("Graph::EventPosition", _wrap_EventPosition, file);
    newXS("Graph::EventKeyCode", _wrap_EventKeyCode, file);
    newXS("Graph::DrawString", _wrap_DrawString, file);
    newXS("Graph::WaitForEvent", _wrap_WaitForEvent, file);
    newXS("Graph::LastEvent", _wrap_LastEvent, file);
    newXS("Graph::ScreenWidth", _wrap_ScreenWidth, file);
    newXS("Graph::ScreenHeight", _wrap_ScreenHeight, file);
    newXS("Graph::WindowWidth", _wrap_WindowWidth, file);
    newXS("Graph::WindowHeight", _wrap_WindowHeight, file);
    newXS("Graph::AvailableColors", _wrap_AvailableColors, file);
    newXS("Graph::StringHeight", _wrap_StringHeight, file);
    newXS("Graph::StringWidth", _wrap_StringWidth, file);
    newXS("Graph::LoadFont", _wrap_LoadFont, file);
    newXS("Graph::SetLineStyle", _wrap_SetLineStyle, file);
    newXS("Graph::SetLineWidth", _wrap_SetLineWidth, file);
    newXS("Graph::AlwaysFlush", _wrap_AlwaysFlush, file);
    newXS("Graph::SetDrawingFunction", _wrap_SetDrawingFunction, file);
    newXS("Graph::SaveSettings", _wrap_SaveSettings, file);
    newXS("Graph::RestoreSettings", _wrap_RestoreSettings, file);
    newXS("Graph::RandomCard", _wrap_RandomCard, file);
    newXS("Graph::SetTitle", _wrap_SetTitle, file);
    newXS("Graph::GetColor", _wrap_GetColor, file);
    newXS("Graph::GetColorRGB", _wrap_GetColorRGB, file);
    newXS("Graph::SetForeground", _wrap_SetForeground, file);
    newXS("Graph::SetBackground", _wrap_SetBackground, file);
    newXS("Graph::DrawCircle", _wrap_DrawCircle, file);
    newXS("Graph::FillCircle", _wrap_FillCircle, file);
    newXS("Graph::ClearArea", _wrap_ClearArea, file);
    newXS("Graph::LoadImage", _wrap_LoadImage, file);
    newXS("Graph::ImageWidth", _wrap_ImageWidth, file);
    newXS("Graph::ImageHeight", _wrap_ImageHeight, file);
    newXS("Graph::PlaceImage", _wrap_PlaceImage, file);
    newXS("Graph::Flush", _wrap_Flush, file);
    newXS("Graph::RestoreImage", _wrap_RestoreImage, file);
    newXS("Graph::FreeImage", _wrap_FreeImage, file);
    newXS("Graph::Sleep", _wrap_Sleep, file);
    newXS("Graph::Wait", _wrap_Wait, file);
    ST(0) = &PL_sv_yes;
    XSRETURN(1);
}

