/* DO NOT EDIT THIS FILE. */
/* This file was generated by xctocc from "wxs_gdi.xc". */


#if defined(_MSC_VER)
# include "wx.h"
#endif

#include "wx_obj.h"
#include "wx_list.h"
#include "wx_gdi.h"
#ifdef wx_xt
# include "wx_dc.h"
#endif
#include "wx_rgn.h"




#ifdef wx_x
# define BM_SELECTED(map) ((map)->selectedTo)
#endif
#if defined(wx_mac) || defined(wx_msw)
# define BM_SELECTED(map) ((map)->selectedInto)
#endif
# define BM_IN_USE(map) ((map)->selectedIntoDC)





#include "wxscheme.h"
#include "wxs_gdi.h"

#ifdef MZ_PRECISE_GC
START_XFORM_SKIP;
#endif


#ifndef wx_mac
# define wxBITMAP_TYPE_PICT 101
#endif

#define wxBITMAP_TYPE_UNKNOWN 0

static Scheme_Object *bitmapType_wxBITMAP_TYPE_BMP_sym = NULL;
static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_sym = NULL;
static Scheme_Object *bitmapType_wxBITMAP_TYPE_XBM_sym = NULL;
static Scheme_Object *bitmapType_wxBITMAP_TYPE_XPM_sym = NULL;
static Scheme_Object *bitmapType_wxBITMAP_TYPE_PICT_sym = NULL;
static Scheme_Object *bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = NULL;

static void init_symset_bitmapType(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(bitmapType_wxBITMAP_TYPE_BMP_sym);
  bitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp"));
  wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_sym);
  bitmapType_wxBITMAP_TYPE_GIF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif"));
  wxREGGLOB(bitmapType_wxBITMAP_TYPE_XBM_sym);
  bitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm"));
  wxREGGLOB(bitmapType_wxBITMAP_TYPE_XPM_sym);
  bitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm"));
  wxREGGLOB(bitmapType_wxBITMAP_TYPE_PICT_sym);
  bitmapType_wxBITMAP_TYPE_PICT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pict"));
  wxREGGLOB(bitmapType_wxBITMAP_TYPE_UNKNOWN_sym);
  bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown"));
}

static int unbundle_symset_bitmapType(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) WITH_VAR_STACK(init_symset_bitmapType());
  if (0) { }
  else if (v == bitmapType_wxBITMAP_TYPE_BMP_sym) { return wxBITMAP_TYPE_BMP; }
  else if (v == bitmapType_wxBITMAP_TYPE_GIF_sym) { return wxBITMAP_TYPE_GIF; }
  else if (v == bitmapType_wxBITMAP_TYPE_XBM_sym) { return wxBITMAP_TYPE_XBM; }
  else if (v == bitmapType_wxBITMAP_TYPE_XPM_sym) { return wxBITMAP_TYPE_XPM; }
  else if (v == bitmapType_wxBITMAP_TYPE_PICT_sym) { return wxBITMAP_TYPE_PICT; }
  else if (v == bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) { return wxBITMAP_TYPE_UNKNOWN; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapType symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_bitmapType(int v) {
  if (!bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) init_symset_bitmapType();
  switch (v) {
  case wxBITMAP_TYPE_BMP: return bitmapType_wxBITMAP_TYPE_BMP_sym;
  case wxBITMAP_TYPE_GIF: return bitmapType_wxBITMAP_TYPE_GIF_sym;
  case wxBITMAP_TYPE_XBM: return bitmapType_wxBITMAP_TYPE_XBM_sym;
  case wxBITMAP_TYPE_XPM: return bitmapType_wxBITMAP_TYPE_XPM_sym;
  case wxBITMAP_TYPE_PICT: return bitmapType_wxBITMAP_TYPE_PICT_sym;
  case wxBITMAP_TYPE_UNKNOWN: return bitmapType_wxBITMAP_TYPE_UNKNOWN_sym;
  default: return NULL;
  }
}




static Scheme_Object *family_wxDEFAULT_sym = NULL;
static Scheme_Object *family_wxDECORATIVE_sym = NULL;
static Scheme_Object *family_wxROMAN_sym = NULL;
static Scheme_Object *family_wxSCRIPT_sym = NULL;
static Scheme_Object *family_wxSWISS_sym = NULL;
static Scheme_Object *family_wxMODERN_sym = NULL;
static Scheme_Object *family_wxSYSTEM_sym = NULL;
static Scheme_Object *family_wxSYMBOL_sym = NULL;

static void init_symset_family(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(family_wxDEFAULT_sym);
  family_wxDEFAULT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("default"));
  wxREGGLOB(family_wxDECORATIVE_sym);
  family_wxDECORATIVE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("decorative"));
  wxREGGLOB(family_wxROMAN_sym);
  family_wxROMAN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("roman"));
  wxREGGLOB(family_wxSCRIPT_sym);
  family_wxSCRIPT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("script"));
  wxREGGLOB(family_wxSWISS_sym);
  family_wxSWISS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("swiss"));
  wxREGGLOB(family_wxMODERN_sym);
  family_wxMODERN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("modern"));
  wxREGGLOB(family_wxSYSTEM_sym);
  family_wxSYSTEM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("system"));
  wxREGGLOB(family_wxSYMBOL_sym);
  family_wxSYMBOL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("symbol"));
}

static int unbundle_symset_family(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!family_wxSYMBOL_sym) WITH_VAR_STACK(init_symset_family());
  if (0) { }
  else if (v == family_wxDEFAULT_sym) { return wxDEFAULT; }
  else if (v == family_wxDECORATIVE_sym) { return wxDECORATIVE; }
  else if (v == family_wxROMAN_sym) { return wxROMAN; }
  else if (v == family_wxSCRIPT_sym) { return wxSCRIPT; }
  else if (v == family_wxSWISS_sym) { return wxSWISS; }
  else if (v == family_wxMODERN_sym) { return wxMODERN; }
  else if (v == family_wxSYSTEM_sym) { return wxSYSTEM; }
  else if (v == family_wxSYMBOL_sym) { return wxSYMBOL; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "family symbol", -1, 0, &v));
  return 0;
}

static int istype_symset_family(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!family_wxSYMBOL_sym) WITH_VAR_STACK(init_symset_family());
  if (0) { }
  else if (v == family_wxDEFAULT_sym) { return 1; }
  else if (v == family_wxDECORATIVE_sym) { return 1; }
  else if (v == family_wxROMAN_sym) { return 1; }
  else if (v == family_wxSCRIPT_sym) { return 1; }
  else if (v == family_wxSWISS_sym) { return 1; }
  else if (v == family_wxMODERN_sym) { return 1; }
  else if (v == family_wxSYSTEM_sym) { return 1; }
  else if (v == family_wxSYMBOL_sym) { return 1; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "family symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_family(int v) {
  if (!family_wxSYMBOL_sym) init_symset_family();
  switch (v) {
  case wxDEFAULT: return family_wxDEFAULT_sym;
  case wxDECORATIVE: return family_wxDECORATIVE_sym;
  case wxROMAN: return family_wxROMAN_sym;
  case wxSCRIPT: return family_wxSCRIPT_sym;
  case wxSWISS: return family_wxSWISS_sym;
  case wxMODERN: return family_wxMODERN_sym;
  case wxSYSTEM: return family_wxSYSTEM_sym;
  case wxSYMBOL: return family_wxSYMBOL_sym;
  default: return NULL;
  }
}


static Scheme_Object *weight_wxNORMAL_sym = NULL;
static Scheme_Object *weight_wxLIGHT_sym = NULL;
static Scheme_Object *weight_wxBOLD_sym = NULL;

static void init_symset_weight(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(weight_wxNORMAL_sym);
  weight_wxNORMAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("normal"));
  wxREGGLOB(weight_wxLIGHT_sym);
  weight_wxLIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("light"));
  wxREGGLOB(weight_wxBOLD_sym);
  weight_wxBOLD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bold"));
}

static int unbundle_symset_weight(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!weight_wxBOLD_sym) WITH_VAR_STACK(init_symset_weight());
  if (0) { }
  else if (v == weight_wxNORMAL_sym) { return wxNORMAL; }
  else if (v == weight_wxLIGHT_sym) { return wxLIGHT; }
  else if (v == weight_wxBOLD_sym) { return wxBOLD; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "weight symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_weight(int v) {
  if (!weight_wxBOLD_sym) init_symset_weight();
  switch (v) {
  case wxNORMAL: return weight_wxNORMAL_sym;
  case wxLIGHT: return weight_wxLIGHT_sym;
  case wxBOLD: return weight_wxBOLD_sym;
  default: return NULL;
  }
}


static Scheme_Object *style_wxNORMAL_sym = NULL;
static Scheme_Object *style_wxITALIC_sym = NULL;
static Scheme_Object *style_wxSLANT_sym = NULL;

static void init_symset_style(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(style_wxNORMAL_sym);
  style_wxNORMAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("normal"));
  wxREGGLOB(style_wxITALIC_sym);
  style_wxITALIC_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("italic"));
  wxREGGLOB(style_wxSLANT_sym);
  style_wxSLANT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("slant"));
}

static int unbundle_symset_style(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!style_wxSLANT_sym) WITH_VAR_STACK(init_symset_style());
  if (0) { }
  else if (v == style_wxNORMAL_sym) { return wxNORMAL; }
  else if (v == style_wxITALIC_sym) { return wxITALIC; }
  else if (v == style_wxSLANT_sym) { return wxSLANT; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "style symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_style(int v) {
  if (!style_wxSLANT_sym) init_symset_style();
  switch (v) {
  case wxNORMAL: return style_wxNORMAL_sym;
  case wxITALIC: return style_wxITALIC_sym;
  case wxSLANT: return style_wxSLANT_sym;
  default: return NULL;
  }
}


#define USE_FONT_NAME_DIRECTORY 1

/* Not used, anyway: */
#if defined(wx_mac) || defined(wx_xt)
# define COLORMAP_CREATE 0
#else
# define COLORMAP_CREATE 1
#endif






class os_wxFont : public wxFont {
 public:

  os_wxFont CONSTRUCTOR_ARGS(());
#ifndef MZ_PRECISE_GC
  os_wxFont CONSTRUCTOR_ARGS((int x0, int x1, int x2, int x3, Bool x4 = 0));
#endif
#ifndef MZ_PRECISE_GC
  os_wxFont CONSTRUCTOR_ARGS((int x0, cstring x1, int x2, int x3, int x4, Bool x5 = 0));
#endif
  ~os_wxFont();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxFont::gcMark() {
  wxFont::gcMark();
}
void os_wxFont::gcFixup() {
  wxFont::gcFixup();
}
#endif

static Scheme_Object *os_wxFont_class;

os_wxFont::os_wxFont CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxFont())
{
}

#ifndef MZ_PRECISE_GC
os_wxFont::os_wxFont CONSTRUCTOR_ARGS((int x0, int x1, int x2, int x3, Bool x4))
CONSTRUCTOR_INIT(: wxFont(x0, x1, x2, x3, x4))
{
}
#endif

#ifndef MZ_PRECISE_GC
os_wxFont::os_wxFont CONSTRUCTOR_ARGS((int x0, cstring x1, int x2, int x3, int x4, Bool x5))
CONSTRUCTOR_INIT(: wxFont(x0, x1, x2, x3, x4, x5))
{
}
#endif

os_wxFont::~os_wxFont()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxFontGetFontId(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetFontId());

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontGetUnderlined(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetUnderlined());

  
  
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxFontGetWeight(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetWeight());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_weight(r));
}

static Scheme_Object *os_wxFontGetPointSize(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetPointSize());

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontGetStyle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetStyle());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_style(r));
}

static Scheme_Object *os_wxFontGetFaceString(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetFaceString());

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r));
}

static Scheme_Object *os_wxFontGetFamily(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)obj)->primdata)->GetFamily());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_family(r));
}

static Scheme_Object *os_wxFont_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, obj);
  PRE_VAR_STACK_PUSH(1, p);
  os_wxFont *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= 2) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[1], NULL))) {
    int x0;
    cstring x1 INIT_NULLED_OUT;
    int x2;
    int x3;
    int x4;
    Bool x5;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x1);

    
    if ((n < 5) ||(n > 6)) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in font% (font name case)", 5, 6, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 1, 255, "initialization in font% (font name case)"));
    x1 = (cstring)WITH_VAR_STACK(objscheme_unbundle_string(p[1], "initialization in font% (font name case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_family(p[2], "initialization in font% (font name case)"));
    x3 = WITH_VAR_STACK(unbundle_symset_style(p[3], "initialization in font% (font name case)"));
    x4 = WITH_VAR_STACK(unbundle_symset_weight(p[4], "initialization in font% (font name case)"));
    if (n > 5) {
      x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[5], "initialization in font% (font name case)"));
    } else
      x5 = 0;

    
    realobj = WITH_VAR_STACK(new os_wxFont CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxFont(x0, x1, x2, x3, x4, x5));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[0], NULL))) {
    int x0;
    int x1;
    int x2;
    int x3;
    Bool x4;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if ((n < 4) ||(n > 5)) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in font% (family case)", 4, 5, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 1, 255, "initialization in font% (family case)"));
    x1 = WITH_VAR_STACK(unbundle_symset_family(p[1], "initialization in font% (family case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_style(p[2], "initialization in font% (family case)"));
    x3 = WITH_VAR_STACK(unbundle_symset_weight(p[3], "initialization in font% (family case)"));
    if (n > 4) {
      x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[4], "initialization in font% (family case)"));
    } else
      x4 = 0;

    
    realobj = WITH_VAR_STACK(new os_wxFont CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxFont(x0, x1, x2, x3, x4));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else  {

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 0) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in font% (no argument case)", 0, 0, n, p));

    
    realobj = WITH_VAR_STACK(new os_wxFont CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxFont());
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  }

  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxFont(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxFont_class);

  os_wxFont_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "font%", "object%", os_wxFont_ConstructScheme, 7));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-font-id", os_wxFontGetFontId, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-underlined", os_wxFontGetUnderlined, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-weight", os_wxFontGetWeight, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-point-size", os_wxFontGetPointSize, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-style", os_wxFontGetStyle, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-face", os_wxFontGetFaceString, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-family", os_wxFontGetFamily, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxFont_class));


}

int objscheme_istype_wxFont(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxFont_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "font% object or " XC_NULL_STR: "font% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxFont(class wxFont *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxFont_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxFont *objscheme_unbundle_wxFont(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxFont(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxFont *)o->primdata;
  else
    return (wxFont *)o->primdata;
}






class os_wxFontList : public wxFontList {
 public:

  os_wxFontList CONSTRUCTOR_ARGS(());
  ~os_wxFontList();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxFontList::gcMark() {
  wxFontList::gcMark();
}
void os_wxFontList::gcFixup() {
  wxFontList::gcFixup();
}
#endif

static Scheme_Object *os_wxFontList_class;

os_wxFontList::os_wxFontList CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxFontList())
{
}

os_wxFontList::~os_wxFontList()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxFontListFindOrCreateFont(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, p);
  PRE_VAR_STACK_PUSH(1, obj);
  REMEMBER_VAR_STACK();
  class wxFont* r INIT_NULLED_OUT;
  objscheme_check_valid(obj);
  if ((n >= 2) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[0], NULL)) && WITH_REMEMBERED_STACK(istype_symset_family(p[1], NULL))) {
    int x0;
    int x1;
    int x2;
    int x3;
    Bool x4;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, r);

    
    if ((n < 4) ||(n > 5)) 
      WITH_VAR_STACK(scheme_wrong_count("find-or-create-font in font-list% (family id case)", 4, 5, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 1, 255, "find-or-create-font in font-list% (family id case)"));
    x1 = WITH_VAR_STACK(unbundle_symset_family(p[1], "find-or-create-font in font-list% (family id case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_style(p[2], "find-or-create-font in font-list% (family id case)"));
    x3 = WITH_VAR_STACK(unbundle_symset_weight(p[3], "find-or-create-font in font-list% (family id case)"));
    if (n > 4) {
      x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[4], "find-or-create-font in font-list% (family id case)"));
    } else
      x4 = 0;

    
    r = WITH_VAR_STACK(((wxFontList *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreateFont(x0, x1, x2, x3, x4));

    
    
  } else  {
#if  USE_FONT_NAME_DIRECTORY
    int x0;
    cstring x1 INIT_NULLED_OUT;
    int x2;
    int x3;
    int x4;
    Bool x5;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, r);
    VAR_STACK_PUSH(3, x1);

    
    if ((n < 5) ||(n > 6)) 
      WITH_VAR_STACK(scheme_wrong_count("find-or-create-font in font-list% (font name case)", 5, 6, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 1, 255, "find-or-create-font in font-list% (font name case)"));
    x1 = (cstring)WITH_VAR_STACK(objscheme_unbundle_string(p[1], "find-or-create-font in font-list% (font name case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_family(p[2], "find-or-create-font in font-list% (font name case)"));
    x3 = WITH_VAR_STACK(unbundle_symset_style(p[3], "find-or-create-font in font-list% (font name case)"));
    x4 = WITH_VAR_STACK(unbundle_symset_weight(p[4], "find-or-create-font in font-list% (font name case)"));
    if (n > 5) {
      x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[5], "find-or-create-font in font-list% (font name case)"));
    } else
      x5 = 0;

    
    r = WITH_VAR_STACK(((wxFontList *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreateFont(x0, x1, x2, x3, x4, x5));

    
    
#else
 scheme_signal_error("%s: provided arglist unsupported on this platform", "find-or-create-font in font-list% (font name case)");
#endif
  }

  return WITH_REMEMBERED_STACK(objscheme_bundle_wxFont(r));
}

static Scheme_Object *os_wxFontList_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, obj);
  os_wxFontList *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();

  SETUP_VAR_STACK_PRE_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, realobj);

  
  if (n != 0) 
    WITH_VAR_STACK(scheme_wrong_count("initialization in font-list%", 0, 0, n, p));

  
  realobj = WITH_VAR_STACK(new os_wxFontList CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxFontList());
#endif
  realobj->__gc_external = (void *)obj;
  objscheme_note_creation(obj);
  
  
  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxFontList(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxFontList_class);

  os_wxFontList_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "font-list%", "object%", os_wxFontList_ConstructScheme, 1));

#if  USE_FONT_NAME_DIRECTORY
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontList_class, "find-or-create-font", os_wxFontListFindOrCreateFont, 4, 6));
#endif


  WITH_VAR_STACK(scheme_made_class(os_wxFontList_class));


  Scheme_Object *xcconsttmp INIT_NULLED_OUT;
  xcconsttmp = WITH_VAR_STACK(objscheme_bundle_wxFontList(wxTheFontList));
  WITH_VAR_STACK(scheme_install_xc_global("the-font-list", xcconsttmp, env));
}

int objscheme_istype_wxFontList(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxFontList_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "font-list% object or " XC_NULL_STR: "font-list% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxFontList(class wxFontList *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxFontList_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxFontList *objscheme_unbundle_wxFontList(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxFontList(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxFontList *)o->primdata;
  else
    return (wxFontList *)o->primdata;
}





// @ "get" : void Get(ubyte*,ubyte*,ubyte*);


class os_wxColour : public wxColour {
 public:

  os_wxColour CONSTRUCTOR_ARGS(());
#ifndef MZ_PRECISE_GC
  os_wxColour CONSTRUCTOR_ARGS((ubyte x0, ubyte x1, ubyte x2));
#endif
#ifndef MZ_PRECISE_GC
  os_wxColour CONSTRUCTOR_ARGS((string x0));
#endif
  ~os_wxColour();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxColour::gcMark() {
  wxColour::gcMark();
}
void os_wxColour::gcFixup() {
  wxColour::gcFixup();
}
#endif

static Scheme_Object *os_wxColour_class;

os_wxColour::os_wxColour CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxColour())
{
}

#ifndef MZ_PRECISE_GC
os_wxColour::os_wxColour CONSTRUCTOR_ARGS((ubyte x0, ubyte x1, ubyte x2))
CONSTRUCTOR_INIT(: wxColour(x0, x1, x2))
{
}
#endif

#ifndef MZ_PRECISE_GC
os_wxColour::os_wxColour CONSTRUCTOR_ARGS((string x0))
CONSTRUCTOR_INIT(: wxColour(x0))
{
}
#endif

os_wxColour::~os_wxColour()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxColourBlue(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  ubyte r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)obj)->primdata)->Blue());

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxColourGreen(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  ubyte r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)obj)->primdata)->Green());

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxColourRed(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  ubyte r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)obj)->primdata)->Red());

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxColourSet(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  ubyte x0;
  ubyte x1;
  ubyte x2;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 0, 255, "set in color%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[1], 0, 255, "set in color%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[2], 0, 255, "set in color%"));

  if (!((wxColour *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("color%","set"), "color", "color"));
  WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)obj)->primdata)->Set(x0, x1, x2));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxColourOk(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)obj)->primdata)->Ok());

  
  
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxColourCopyFrom(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  objscheme_check_valid(obj);
  class wxColour* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "copy-from in color%", 0));

  if (!((wxColour *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("color%","copy-from"), "color", "color"));
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)obj)->primdata)->CopyFrom(x0));

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

static Scheme_Object *os_wxColour_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, obj);
  PRE_VAR_STACK_PUSH(1, p);
  os_wxColour *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0], NULL))) {
    string x0 INIT_NULLED_OUT;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 1) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in color% (color name case)", 1, 1, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "initialization in color% (color name case)"));

    
    realobj = WITH_VAR_STACK(new os_wxColour CONSTRUCTOR_ARGS((x0)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxColour(x0));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[0], NULL))) {
    ubyte x0;
    ubyte x1;
    ubyte x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in color% (rgb values case)", 3, 3, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 0, 255, "initialization in color% (rgb values case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[1], 0, 255, "initialization in color% (rgb values case)"));
    x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[2], 0, 255, "initialization in color% (rgb values case)"));

    
    realobj = WITH_VAR_STACK(new os_wxColour CONSTRUCTOR_ARGS((x0, x1, x2)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxColour(x0, x1, x2));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else  {

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 0) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in color% (no argument case)", 0, 0, n, p));

    
    realobj = WITH_VAR_STACK(new os_wxColour CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxColour());
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  }

  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxColour(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxColour_class);

  os_wxColour_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "color%", "object%", os_wxColour_ConstructScheme, 6));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColour_class, "blue", os_wxColourBlue, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColour_class, "green", os_wxColourGreen, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColour_class, "red", os_wxColourRed, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColour_class, "set", os_wxColourSet, 3, 3));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColour_class, "ok?", os_wxColourOk, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColour_class, "copy-from", os_wxColourCopyFrom, 1, 1));


  WITH_VAR_STACK(scheme_made_class(os_wxColour_class));


}

int objscheme_istype_wxColour(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxColour_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "color% object or " XC_NULL_STR: "color% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxColour(class wxColour *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxColour_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxColour *objscheme_unbundle_wxColour(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxColour(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxColour *)o->primdata;
  else
    return (wxColour *)o->primdata;
}



#ifdef wx_mac
#define _KEY_TYPE KeyType
#else
#define _KEY_TYPE int
#endif

// Since we don't allow creating this anymore, need a Mac fix:
#if defined(wx_mac)
#define CDB_FIX os_wxColourDatabase(_KEY_TYPE x) : wxColourDatabase(x) {}
#else
#define CDB_FIX 
#endif





class os_wxColourDatabase : public wxColourDatabase {
 public:
  CDB_FIX

  ~os_wxColourDatabase();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxColourDatabase::gcMark() {
  wxColourDatabase::gcMark();
}
void os_wxColourDatabase::gcFixup() {
  wxColourDatabase::gcFixup();
}
#endif

static Scheme_Object *os_wxColourDatabase_class;
static Scheme_Object *os_wxColourDatabase_interface;

os_wxColourDatabase::~os_wxColourDatabase()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxColourDatabaseFindColour(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  objscheme_check_valid(obj);
  string x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "find-color in color-database<%>"));

  
  r = WITH_VAR_STACK(((wxColourDatabase *)((Scheme_Class_Object *)obj)->primdata)->FindColour(x0));

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

void objscheme_setup_wxColourDatabase(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxColourDatabase_class);
  wxREGGLOB(os_wxColourDatabase_interface);

  os_wxColourDatabase_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "color-database%", "object%", NULL, 1));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxColourDatabase_class, "find-color", os_wxColourDatabaseFindColour, 1, 1));


  WITH_VAR_STACK(scheme_made_class(os_wxColourDatabase_class));

  os_wxColourDatabase_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxColourDatabase_class, "color-database" "<%>"));

  WITH_VAR_STACK(objscheme_add_global_interface(os_wxColourDatabase_interface, "color-database" "<%>", env));

  Scheme_Object *xcconsttmp INIT_NULLED_OUT;
  xcconsttmp = WITH_VAR_STACK(objscheme_bundle_wxColourDatabase(wxTheColourDatabase));
  WITH_VAR_STACK(scheme_install_xc_global("the-color-database", xcconsttmp, env));
}

int objscheme_istype_wxColourDatabase(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxColourDatabase_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "color-database% object or " XC_NULL_STR: "color-database% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxColourDatabase(class wxColourDatabase *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxColourDatabase_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxColourDatabase *objscheme_unbundle_wxColourDatabase(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxColourDatabase(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxColourDatabase *)o->primdata;
  else
    return (wxColourDatabase *)o->primdata;
}






class os_wxPoint : public wxPoint {
 public:

  os_wxPoint CONSTRUCTOR_ARGS(());
#ifndef MZ_PRECISE_GC
  os_wxPoint CONSTRUCTOR_ARGS((float x0, float x1));
#endif
  ~os_wxPoint();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxPoint::gcMark() {
  wxPoint::gcMark();
}
void os_wxPoint::gcFixup() {
  wxPoint::gcFixup();
}
#endif

static Scheme_Object *os_wxPoint_class;

os_wxPoint::os_wxPoint CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxPoint())
{
}

#ifndef MZ_PRECISE_GC
os_wxPoint::os_wxPoint CONSTRUCTOR_ARGS((float x0, float x1))
CONSTRUCTOR_INIT(: wxPoint(x0, x1))
{
}
#endif

os_wxPoint::~os_wxPoint()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *objscheme_wxPoint_Getx(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  float v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(obj);
  if (n) WITH_REMEMBERED_STACK(scheme_wrong_count("get-x in point%", 0, 0, n, p));
  cobj = (Scheme_Class_Object *)obj;
  if (cobj->primflag)
    v = ((os_wxPoint *)cobj->primdata)->wxPoint::x;
  else
    v = ((wxPoint *)cobj->primdata)->x;

  return WITH_REMEMBERED_STACK(scheme_make_double(v));
}

static Scheme_Object *objscheme_wxPoint_Setx(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)obj;
  float v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(obj));
  if (n != 1) WITH_VAR_STACK(scheme_wrong_count("set-x in point%", 1, 1, n, p));

  v = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "set-x in point%"));
  ((wxPoint *)cobj->primdata)->x = v;

  return scheme_void;
}

static Scheme_Object *objscheme_wxPoint_Gety(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  float v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(obj);
  if (n) WITH_REMEMBERED_STACK(scheme_wrong_count("get-y in point%", 0, 0, n, p));
  cobj = (Scheme_Class_Object *)obj;
  if (cobj->primflag)
    v = ((os_wxPoint *)cobj->primdata)->wxPoint::y;
  else
    v = ((wxPoint *)cobj->primdata)->y;

  return WITH_REMEMBERED_STACK(scheme_make_double(v));
}

static Scheme_Object *objscheme_wxPoint_Sety(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)obj;
  float v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(obj));
  if (n != 1) WITH_VAR_STACK(scheme_wrong_count("set-y in point%", 1, 1, n, p));

  v = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "set-y in point%"));
  ((wxPoint *)cobj->primdata)->y = v;

  return scheme_void;
}

static Scheme_Object *os_wxPoint_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, obj);
  PRE_VAR_STACK_PUSH(1, p);
  os_wxPoint *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[0], NULL))) {
    float x0;
    float x1;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 2) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in point% (xy values case)", 2, 2, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "initialization in point% (xy values case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_float(p[1], "initialization in point% (xy values case)"));

    
    realobj = WITH_VAR_STACK(new os_wxPoint CONSTRUCTOR_ARGS((x0, x1)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPoint(x0, x1));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else  {

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 0) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in point% (no argument case)", 0, 0, n, p));

    
    realobj = WITH_VAR_STACK(new os_wxPoint CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPoint());
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  }

  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxPoint(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxPoint_class);

  os_wxPoint_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "point%", "object%", os_wxPoint_ConstructScheme, 4));


  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPoint_class,"get-x", objscheme_wxPoint_Getx, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPoint_class,"set-x", objscheme_wxPoint_Setx, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPoint_class,"get-y", objscheme_wxPoint_Gety, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPoint_class,"set-y", objscheme_wxPoint_Sety, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxPoint_class));


}

int objscheme_istype_wxPoint(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxPoint_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "point% object or " XC_NULL_STR: "point% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxPoint(class wxPoint *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPoint_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxPoint *objscheme_unbundle_wxPoint(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxPoint(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxPoint *)o->primdata;
  else
    return (wxPoint *)o->primdata;
}


static Scheme_Object *brushStyle_wxTRANSPARENT_sym = NULL;
static Scheme_Object *brushStyle_wxSOLID_sym = NULL;
static Scheme_Object *brushStyle_wxSTIPPLE_sym = NULL;
static Scheme_Object *brushStyle_wxXOR_sym = NULL;
static Scheme_Object *brushStyle_wxBDIAGONAL_HATCH_sym = NULL;
static Scheme_Object *brushStyle_wxCROSSDIAG_HATCH_sym = NULL;
static Scheme_Object *brushStyle_wxFDIAGONAL_HATCH_sym = NULL;
static Scheme_Object *brushStyle_wxCROSS_HATCH_sym = NULL;
static Scheme_Object *brushStyle_wxHORIZONTAL_HATCH_sym = NULL;
static Scheme_Object *brushStyle_wxVERTICAL_HATCH_sym = NULL;

static void init_symset_brushStyle(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(brushStyle_wxTRANSPARENT_sym);
  brushStyle_wxTRANSPARENT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("transparent"));
  wxREGGLOB(brushStyle_wxSOLID_sym);
  brushStyle_wxSOLID_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("solid"));
  wxREGGLOB(brushStyle_wxSTIPPLE_sym);
  brushStyle_wxSTIPPLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("opaque"));
  wxREGGLOB(brushStyle_wxXOR_sym);
  brushStyle_wxXOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor"));
  wxREGGLOB(brushStyle_wxBDIAGONAL_HATCH_sym);
  brushStyle_wxBDIAGONAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bdiagonal-hatch"));
  wxREGGLOB(brushStyle_wxCROSSDIAG_HATCH_sym);
  brushStyle_wxCROSSDIAG_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("crossdiag-hatch"));
  wxREGGLOB(brushStyle_wxFDIAGONAL_HATCH_sym);
  brushStyle_wxFDIAGONAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("fdiagonal-hatch"));
  wxREGGLOB(brushStyle_wxCROSS_HATCH_sym);
  brushStyle_wxCROSS_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("cross-hatch"));
  wxREGGLOB(brushStyle_wxHORIZONTAL_HATCH_sym);
  brushStyle_wxHORIZONTAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("horizontal-hatch"));
  wxREGGLOB(brushStyle_wxVERTICAL_HATCH_sym);
  brushStyle_wxVERTICAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("vertical-hatch"));
}

static int unbundle_symset_brushStyle(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!brushStyle_wxVERTICAL_HATCH_sym) WITH_VAR_STACK(init_symset_brushStyle());
  if (0) { }
  else if (v == brushStyle_wxTRANSPARENT_sym) { return wxTRANSPARENT; }
  else if (v == brushStyle_wxSOLID_sym) { return wxSOLID; }
  else if (v == brushStyle_wxSTIPPLE_sym) { return wxSTIPPLE; }
  else if (v == brushStyle_wxXOR_sym) { return wxXOR; }
  else if (v == brushStyle_wxBDIAGONAL_HATCH_sym) { return wxBDIAGONAL_HATCH; }
  else if (v == brushStyle_wxCROSSDIAG_HATCH_sym) { return wxCROSSDIAG_HATCH; }
  else if (v == brushStyle_wxFDIAGONAL_HATCH_sym) { return wxFDIAGONAL_HATCH; }
  else if (v == brushStyle_wxCROSS_HATCH_sym) { return wxCROSS_HATCH; }
  else if (v == brushStyle_wxHORIZONTAL_HATCH_sym) { return wxHORIZONTAL_HATCH; }
  else if (v == brushStyle_wxVERTICAL_HATCH_sym) { return wxVERTICAL_HATCH; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "brushStyle symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_brushStyle(int v) {
  if (!brushStyle_wxVERTICAL_HATCH_sym) init_symset_brushStyle();
  switch (v) {
  case wxTRANSPARENT: return brushStyle_wxTRANSPARENT_sym;
  case wxSOLID: return brushStyle_wxSOLID_sym;
  case wxSTIPPLE: return brushStyle_wxSTIPPLE_sym;
  case wxXOR: return brushStyle_wxXOR_sym;
  case wxBDIAGONAL_HATCH: return brushStyle_wxBDIAGONAL_HATCH_sym;
  case wxCROSSDIAG_HATCH: return brushStyle_wxCROSSDIAG_HATCH_sym;
  case wxFDIAGONAL_HATCH: return brushStyle_wxFDIAGONAL_HATCH_sym;
  case wxCROSS_HATCH: return brushStyle_wxCROSS_HATCH_sym;
  case wxHORIZONTAL_HATCH: return brushStyle_wxHORIZONTAL_HATCH_sym;
  case wxVERTICAL_HATCH: return brushStyle_wxVERTICAL_HATCH_sym;
  default: return NULL;
  }
}







class os_wxBrush : public wxBrush {
 public:

  os_wxBrush CONSTRUCTOR_ARGS(());
#ifndef MZ_PRECISE_GC
  os_wxBrush CONSTRUCTOR_ARGS((class wxColour* x0, int x1));
#endif
#ifndef MZ_PRECISE_GC
  os_wxBrush CONSTRUCTOR_ARGS((string x0, int x1));
#endif
  ~os_wxBrush();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxBrush::gcMark() {
  wxBrush::gcMark();
}
void os_wxBrush::gcFixup() {
  wxBrush::gcFixup();
}
#endif

static Scheme_Object *os_wxBrush_class;

os_wxBrush::os_wxBrush CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxBrush())
{
}

#ifndef MZ_PRECISE_GC
os_wxBrush::os_wxBrush CONSTRUCTOR_ARGS((class wxColour* x0, int x1))
CONSTRUCTOR_INIT(: wxBrush(x0, x1))
{
}
#endif

#ifndef MZ_PRECISE_GC
os_wxBrush::os_wxBrush CONSTRUCTOR_ARGS((string x0, int x1))
CONSTRUCTOR_INIT(: wxBrush(x0, x1))
{
}
#endif

os_wxBrush::~os_wxBrush()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxBrushSetStyle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[0], "set-style in brush%"));

  if (!((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("brush%","set-style"), "brush", "brush"));
  WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->SetStyle(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxBrushGetStyle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->GetStyle());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_brushStyle(r));
}

static Scheme_Object *os_wxBrushSetStipple(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  class wxBitmap* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[0], "set-stipple in brush%", 1));

  { if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("brush%","set-stipple"), "bad bitmap: ", p[0])); if (x0 && BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("brush%","set-stipple"), "bitmap is currently installed into a bitmap-dc%: ", p[0])); }if (!((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("brush%","set-stipple"), "brush", "brush"));
  WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->SetStipple(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxBrushGetStipple(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxBitmap* r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->GetStipple());

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r));
}

static Scheme_Object *os_wxBrushSetColour(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, p);
  PRE_VAR_STACK_PUSH(1, obj);
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, x0);

    
    if (n != 1) 
      WITH_VAR_STACK(scheme_wrong_count("set-color in brush% (color% case)", 1, 1, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "set-color in brush% (color% case)", 0));

    if (!((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("brush%","set-colour"), "brush", "brush"));
    WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->SetColour(x0));

    
    
  } else if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0], NULL))) {
    string x0 INIT_NULLED_OUT;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, x0);

    
    if (n != 1) 
      WITH_VAR_STACK(scheme_wrong_count("set-color in brush% (color name case)", 1, 1, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "set-color in brush% (color name case)"));

    if (!((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("brush%","set-colour"), "brush", "brush"));
    WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->SetColour(x0));

    
    
  } else  {
    ubyte x0;
    ubyte x1;
    ubyte x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(2);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("set-color in brush% (rgb values case)", 3, 3, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 0, 255, "set-color in brush% (rgb values case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[1], 0, 255, "set-color in brush% (rgb values case)"));
    x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[2], 0, 255, "set-color in brush% (rgb values case)"));

    if (!((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("brush%","set-colour"), "brush", "brush"));
    WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->SetColour(x0, x1, x2));

    
    
  }

  return scheme_void;
}

static Scheme_Object *os_wxBrushGetColour(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)obj)->primdata)->GetColour());

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

static Scheme_Object *os_wxBrush_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, obj);
  PRE_VAR_STACK_PUSH(1, p);
  os_wxBrush *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0], NULL))) {
    string x0 INIT_NULLED_OUT;
    int x1;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 2) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in brush% (color name case)", 2, 2, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "initialization in brush% (color name case)"));
    x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[1], "initialization in brush% (color name case)"));

    
    realobj = WITH_VAR_STACK(new os_wxBrush CONSTRUCTOR_ARGS((x0, x1)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxBrush(x0, x1));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    int x1;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 2) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in brush% (color% case)", 2, 2, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "initialization in brush% (color% case)", 0));
    x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[1], "initialization in brush% (color% case)"));

    
    realobj = WITH_VAR_STACK(new os_wxBrush CONSTRUCTOR_ARGS((x0, x1)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxBrush(x0, x1));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else  {

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 0) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in brush% (no argument case)", 0, 0, n, p));

    
    realobj = WITH_VAR_STACK(new os_wxBrush CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxBrush());
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  }

  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxBrush(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxBrush_class);

  os_wxBrush_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "brush%", "object%", os_wxBrush_ConstructScheme, 6));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrush_class, "set-style", os_wxBrushSetStyle, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrush_class, "get-style", os_wxBrushGetStyle, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrush_class, "set-stipple", os_wxBrushSetStipple, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrush_class, "get-stipple", os_wxBrushGetStipple, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrush_class, "set-color", os_wxBrushSetColour, 1, 3));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrush_class, "get-color", os_wxBrushGetColour, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxBrush_class));


}

int objscheme_istype_wxBrush(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxBrush_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "brush% object or " XC_NULL_STR: "brush% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxBrush(class wxBrush *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxBrush_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxBrush *objscheme_unbundle_wxBrush(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxBrush(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxBrush *)o->primdata;
  else
    return (wxBrush *)o->primdata;
}






class os_wxBrushList : public wxBrushList {
 public:

  os_wxBrushList CONSTRUCTOR_ARGS(());
  ~os_wxBrushList();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxBrushList::gcMark() {
  wxBrushList::gcMark();
}
void os_wxBrushList::gcFixup() {
  wxBrushList::gcFixup();
}
#endif

static Scheme_Object *os_wxBrushList_class;

os_wxBrushList::os_wxBrushList CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxBrushList())
{
}

os_wxBrushList::~os_wxBrushList()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxBrushListFindOrCreateBrush(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, p);
  PRE_VAR_STACK_PUSH(1, obj);
  REMEMBER_VAR_STACK();
  class wxBrush* r INIT_NULLED_OUT;
  objscheme_check_valid(obj);
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    int x1;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, r);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 2) 
      WITH_VAR_STACK(scheme_wrong_count("find-or-create-brush in brush-list% (color% case)", 2, 2, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "find-or-create-brush in brush-list% (color% case)", 0));
    x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[1], "find-or-create-brush in brush-list% (color% case)"));

    
    r = WITH_VAR_STACK(((wxBrushList *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreateBrush(x0, x1));

    
    
  } else  {
    string x0 INIT_NULLED_OUT;
    int x1;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, r);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 2) 
      WITH_VAR_STACK(scheme_wrong_count("find-or-create-brush in brush-list% (color name case)", 2, 2, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "find-or-create-brush in brush-list% (color name case)"));
    x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[1], "find-or-create-brush in brush-list% (color name case)"));

    
    r = WITH_VAR_STACK(((wxBrushList *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreateBrush(x0, x1));

    
    
  }

  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBrush(r));
}

static Scheme_Object *os_wxBrushList_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, obj);
  os_wxBrushList *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();

  SETUP_VAR_STACK_PRE_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, realobj);

  
  if (n != 0) 
    WITH_VAR_STACK(scheme_wrong_count("initialization in brush-list%", 0, 0, n, p));

  
  realobj = WITH_VAR_STACK(new os_wxBrushList CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxBrushList());
#endif
  realobj->__gc_external = (void *)obj;
  objscheme_note_creation(obj);
  
  
  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxBrushList(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxBrushList_class);

  os_wxBrushList_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "brush-list%", "object%", os_wxBrushList_ConstructScheme, 1));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBrushList_class, "find-or-create-brush", os_wxBrushListFindOrCreateBrush, 2, 2));


  WITH_VAR_STACK(scheme_made_class(os_wxBrushList_class));


  Scheme_Object *xcconsttmp INIT_NULLED_OUT;
  xcconsttmp = WITH_VAR_STACK(objscheme_bundle_wxBrushList(wxTheBrushList));
  WITH_VAR_STACK(scheme_install_xc_global("the-brush-list", xcconsttmp, env));
}

int objscheme_istype_wxBrushList(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxBrushList_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "brush-list% object or " XC_NULL_STR: "brush-list% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxBrushList(class wxBrushList *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxBrushList_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxBrushList *objscheme_unbundle_wxBrushList(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxBrushList(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxBrushList *)o->primdata;
  else
    return (wxBrushList *)o->primdata;
}


static Scheme_Object *penStyle_wxTRANSPARENT_sym = NULL;
static Scheme_Object *penStyle_wxSOLID_sym = NULL;
static Scheme_Object *penStyle_wxXOR_sym = NULL;
static Scheme_Object *penStyle_wxDOT_sym = NULL;
static Scheme_Object *penStyle_wxLONG_DASH_sym = NULL;
static Scheme_Object *penStyle_wxSHORT_DASH_sym = NULL;
static Scheme_Object *penStyle_wxDOT_DASH_sym = NULL;
static Scheme_Object *penStyle_wxXOR_DOT_sym = NULL;
static Scheme_Object *penStyle_wxXOR_LONG_DASH_sym = NULL;
static Scheme_Object *penStyle_wxXOR_SHORT_DASH_sym = NULL;
static Scheme_Object *penStyle_wxXOR_DOT_DASH_sym = NULL;

static void init_symset_penStyle(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(penStyle_wxTRANSPARENT_sym);
  penStyle_wxTRANSPARENT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("transparent"));
  wxREGGLOB(penStyle_wxSOLID_sym);
  penStyle_wxSOLID_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("solid"));
  wxREGGLOB(penStyle_wxXOR_sym);
  penStyle_wxXOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor"));
  wxREGGLOB(penStyle_wxDOT_sym);
  penStyle_wxDOT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("dot"));
  wxREGGLOB(penStyle_wxLONG_DASH_sym);
  penStyle_wxLONG_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("long-dash"));
  wxREGGLOB(penStyle_wxSHORT_DASH_sym);
  penStyle_wxSHORT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("short-dash"));
  wxREGGLOB(penStyle_wxDOT_DASH_sym);
  penStyle_wxDOT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("dot-dash"));
  wxREGGLOB(penStyle_wxXOR_DOT_sym);
  penStyle_wxXOR_DOT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-dot"));
  wxREGGLOB(penStyle_wxXOR_LONG_DASH_sym);
  penStyle_wxXOR_LONG_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-long-dash"));
  wxREGGLOB(penStyle_wxXOR_SHORT_DASH_sym);
  penStyle_wxXOR_SHORT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-short-dash"));
  wxREGGLOB(penStyle_wxXOR_DOT_DASH_sym);
  penStyle_wxXOR_DOT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-dot-dash"));
}

static int unbundle_symset_penStyle(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!penStyle_wxXOR_DOT_DASH_sym) WITH_VAR_STACK(init_symset_penStyle());
  if (0) { }
  else if (v == penStyle_wxTRANSPARENT_sym) { return wxTRANSPARENT; }
  else if (v == penStyle_wxSOLID_sym) { return wxSOLID; }
  else if (v == penStyle_wxXOR_sym) { return wxXOR; }
  else if (v == penStyle_wxDOT_sym) { return wxDOT; }
  else if (v == penStyle_wxLONG_DASH_sym) { return wxLONG_DASH; }
  else if (v == penStyle_wxSHORT_DASH_sym) { return wxSHORT_DASH; }
  else if (v == penStyle_wxDOT_DASH_sym) { return wxDOT_DASH; }
  else if (v == penStyle_wxXOR_DOT_sym) { return wxXOR_DOT; }
  else if (v == penStyle_wxXOR_LONG_DASH_sym) { return wxXOR_LONG_DASH; }
  else if (v == penStyle_wxXOR_SHORT_DASH_sym) { return wxXOR_SHORT_DASH; }
  else if (v == penStyle_wxXOR_DOT_DASH_sym) { return wxXOR_DOT_DASH; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "penStyle symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_penStyle(int v) {
  if (!penStyle_wxXOR_DOT_DASH_sym) init_symset_penStyle();
  switch (v) {
  case wxTRANSPARENT: return penStyle_wxTRANSPARENT_sym;
  case wxSOLID: return penStyle_wxSOLID_sym;
  case wxXOR: return penStyle_wxXOR_sym;
  case wxDOT: return penStyle_wxDOT_sym;
  case wxLONG_DASH: return penStyle_wxLONG_DASH_sym;
  case wxSHORT_DASH: return penStyle_wxSHORT_DASH_sym;
  case wxDOT_DASH: return penStyle_wxDOT_DASH_sym;
  case wxXOR_DOT: return penStyle_wxXOR_DOT_sym;
  case wxXOR_LONG_DASH: return penStyle_wxXOR_LONG_DASH_sym;
  case wxXOR_SHORT_DASH: return penStyle_wxXOR_SHORT_DASH_sym;
  case wxXOR_DOT_DASH: return penStyle_wxXOR_DOT_DASH_sym;
  default: return NULL;
  }
}


static Scheme_Object *join_wxJOIN_BEVEL_sym = NULL;
static Scheme_Object *join_wxJOIN_MITER_sym = NULL;
static Scheme_Object *join_wxJOIN_ROUND_sym = NULL;

static void init_symset_join(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(join_wxJOIN_BEVEL_sym);
  join_wxJOIN_BEVEL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bevel"));
  wxREGGLOB(join_wxJOIN_MITER_sym);
  join_wxJOIN_MITER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("miter"));
  wxREGGLOB(join_wxJOIN_ROUND_sym);
  join_wxJOIN_ROUND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("round"));
}

static int unbundle_symset_join(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!join_wxJOIN_ROUND_sym) WITH_VAR_STACK(init_symset_join());
  if (0) { }
  else if (v == join_wxJOIN_BEVEL_sym) { return wxJOIN_BEVEL; }
  else if (v == join_wxJOIN_MITER_sym) { return wxJOIN_MITER; }
  else if (v == join_wxJOIN_ROUND_sym) { return wxJOIN_ROUND; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "join symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_join(int v) {
  if (!join_wxJOIN_ROUND_sym) init_symset_join();
  switch (v) {
  case wxJOIN_BEVEL: return join_wxJOIN_BEVEL_sym;
  case wxJOIN_MITER: return join_wxJOIN_MITER_sym;
  case wxJOIN_ROUND: return join_wxJOIN_ROUND_sym;
  default: return NULL;
  }
}


static Scheme_Object *cap_wxCAP_ROUND_sym = NULL;
static Scheme_Object *cap_wxCAP_PROJECTING_sym = NULL;
static Scheme_Object *cap_wxCAP_BUTT_sym = NULL;

static void init_symset_cap(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(cap_wxCAP_ROUND_sym);
  cap_wxCAP_ROUND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("round"));
  wxREGGLOB(cap_wxCAP_PROJECTING_sym);
  cap_wxCAP_PROJECTING_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("projecting"));
  wxREGGLOB(cap_wxCAP_BUTT_sym);
  cap_wxCAP_BUTT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("butt"));
}

static int unbundle_symset_cap(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!cap_wxCAP_BUTT_sym) WITH_VAR_STACK(init_symset_cap());
  if (0) { }
  else if (v == cap_wxCAP_ROUND_sym) { return wxCAP_ROUND; }
  else if (v == cap_wxCAP_PROJECTING_sym) { return wxCAP_PROJECTING; }
  else if (v == cap_wxCAP_BUTT_sym) { return wxCAP_BUTT; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "cap symbol", -1, 0, &v));
  return 0;
}

static Scheme_Object *bundle_symset_cap(int v) {
  if (!cap_wxCAP_BUTT_sym) init_symset_cap();
  switch (v) {
  case wxCAP_ROUND: return cap_wxCAP_ROUND_sym;
  case wxCAP_PROJECTING: return cap_wxCAP_PROJECTING_sym;
  case wxCAP_BUTT: return cap_wxCAP_BUTT_sym;
  default: return NULL;
  }
}









class os_wxPen : public wxPen {
 public:

  os_wxPen CONSTRUCTOR_ARGS(());
#ifndef MZ_PRECISE_GC
  os_wxPen CONSTRUCTOR_ARGS((class wxColour* x0, float x1, int x2));
#endif
#ifndef MZ_PRECISE_GC
  os_wxPen CONSTRUCTOR_ARGS((string x0, float x1, int x2));
#endif
  ~os_wxPen();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxPen::gcMark() {
  wxPen::gcMark();
}
void os_wxPen::gcFixup() {
  wxPen::gcFixup();
}
#endif

static Scheme_Object *os_wxPen_class;

os_wxPen::os_wxPen CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxPen())
{
}

#ifndef MZ_PRECISE_GC
os_wxPen::os_wxPen CONSTRUCTOR_ARGS((class wxColour* x0, float x1, int x2))
CONSTRUCTOR_INIT(: wxPen(x0, x1, x2))
{
}
#endif

#ifndef MZ_PRECISE_GC
os_wxPen::os_wxPen CONSTRUCTOR_ARGS((string x0, float x1, int x2))
CONSTRUCTOR_INIT(: wxPen(x0, x1, x2))
{
}
#endif

os_wxPen::~os_wxPen()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxPenSetStyle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(unbundle_symset_penStyle(p[0], "set-style in pen%"));

  if (!((wxPen *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("pen%","set-style"), "pen", "pen"));
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetStyle(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxPenGetStyle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->GetStyle());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_penStyle(r));
}

static Scheme_Object *os_wxPenSetStipple(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  class wxBitmap* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[0], "set-stipple in pen%", 1));

  if (x0 && (x0->GetDepth() != 1)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("pen%","set-stipple"), "bitmap is not monochrome: ", p[0]));if (x0 && ((x0->GetWidth() != 8) || (x0->GetHeight() != 8))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("pen%","set-stipple"), "bitmap is not 8x8: ", p[0]));{ if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("pen%","set-stipple"), "bad bitmap: ", p[0])); if (x0 && BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("pen%","set-stipple"), "bitmap is currently installed into a bitmap-dc%: ", p[0])); }if (!((wxPen *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("pen%","set-stipple"), "pen", "pen"));
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetStipple(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxPenGetStipple(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxBitmap* r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->GetStipple());

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r));
}

static Scheme_Object *os_wxPenSetColour(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, p);
  PRE_VAR_STACK_PUSH(1, obj);
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, x0);

    
    if (n != 1) 
      WITH_VAR_STACK(scheme_wrong_count("set-color in pen% (color% case)", 1, 1, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "set-color in pen% (color% case)", 0));

    if (!((wxPen *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("pen%","set-colour"), "pen", "pen"));
    WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetColour(x0));

    
    
  } else if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0], NULL))) {
    string x0 INIT_NULLED_OUT;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, x0);

    
    if (n != 1) 
      WITH_VAR_STACK(scheme_wrong_count("set-color in pen% (color name case)", 1, 1, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "set-color in pen% (color name case)"));

    if (!((wxPen *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("pen%","set-colour"), "pen", "pen"));
    WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetColour(x0));

    
    
  } else  {
    ubyte x0;
    ubyte x1;
    ubyte x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(2);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("set-color in pen% (rgb values case)", 3, 3, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[0], 0, 255, "set-color in pen% (rgb values case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[1], 0, 255, "set-color in pen% (rgb values case)"));
    x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[2], 0, 255, "set-color in pen% (rgb values case)"));

    if (!((wxPen *)((Scheme_Class_Object *)obj)->primdata)->IsMutable()) WITH_VAR_STACK(scheme_signal_error("%s: this %s%% object is locked (in use by a dc<%%> object or in a list of %s constants)", METHODNAME("pen%","set-colour"), "pen", "pen"));
    WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetColour(x0, x1, x2));

    
    
  }

  return scheme_void;
}

static Scheme_Object *os_wxPenGetColour(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->GetColour());

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

static Scheme_Object *os_wxPenSetJoin(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(unbundle_symset_join(p[0], "set-join in pen%"));

  
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetJoin(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxPenGetJoin(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->GetJoin());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_join(r));
}

static Scheme_Object *os_wxPenSetCap(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(unbundle_symset_cap(p[0], "set-cap in pen%"));

  
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetCap(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxPenGetCap(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->GetCap());

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_cap(r));
}

static Scheme_Object *os_wxPenSetWidth(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  float x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_float_in(p[0], 0, 255, "set-width in pen%"));

  
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->SetWidth(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxPenGetWidthF(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  float r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)obj)->primdata)->GetWidthF());

  
  
  return WITH_REMEMBERED_STACK(scheme_make_double(r));
}

static Scheme_Object *os_wxPen_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, obj);
  PRE_VAR_STACK_PUSH(1, p);
  os_wxPen *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0], NULL))) {
    string x0 INIT_NULLED_OUT;
    float x1;
    int x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in pen% (color name case)", 3, 3, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "initialization in pen% (color name case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_float_in(p[1], 0, 255, "initialization in pen% (color name case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[2], "initialization in pen% (color name case)"));

    
    realobj = WITH_VAR_STACK(new os_wxPen CONSTRUCTOR_ARGS((x0, x1, x2)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPen(x0, x1, x2));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    float x1;
    int x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in pen% (color% case)", 3, 3, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "initialization in pen% (color% case)", 0));
    x1 = WITH_VAR_STACK(objscheme_unbundle_float_in(p[1], 0, 255, "initialization in pen% (color% case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[2], "initialization in pen% (color% case)"));

    
    realobj = WITH_VAR_STACK(new os_wxPen CONSTRUCTOR_ARGS((x0, x1, x2)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPen(x0, x1, x2));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else  {

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 0) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in pen% (no argument case)", 0, 0, n, p));

    
    realobj = WITH_VAR_STACK(new os_wxPen CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPen());
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  }

  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxPen(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxPen_class);

  os_wxPen_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "pen%", "object%", os_wxPen_ConstructScheme, 12));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "set-style", os_wxPenSetStyle, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "get-style", os_wxPenGetStyle, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "set-stipple", os_wxPenSetStipple, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "get-stipple", os_wxPenGetStipple, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "set-color", os_wxPenSetColour, 1, 3));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "get-color", os_wxPenGetColour, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "set-join", os_wxPenSetJoin, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "get-join", os_wxPenGetJoin, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "set-cap", os_wxPenSetCap, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "get-cap", os_wxPenGetCap, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "set-width", os_wxPenSetWidth, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPen_class, "get-width", os_wxPenGetWidthF, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxPen_class));


}

int objscheme_istype_wxPen(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxPen_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "pen% object or " XC_NULL_STR: "pen% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxPen(class wxPen *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPen_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxPen *objscheme_unbundle_wxPen(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxPen(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxPen *)o->primdata;
  else
    return (wxPen *)o->primdata;
}







class os_wxPenList : public wxPenList {
 public:

  os_wxPenList CONSTRUCTOR_ARGS(());
  ~os_wxPenList();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxPenList::gcMark() {
  wxPenList::gcMark();
}
void os_wxPenList::gcFixup() {
  wxPenList::gcFixup();
}
#endif

static Scheme_Object *os_wxPenList_class;

os_wxPenList::os_wxPenList CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxPenList())
{
}

os_wxPenList::~os_wxPenList()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxPenListFindOrCreatePen(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, p);
  PRE_VAR_STACK_PUSH(1, obj);
  REMEMBER_VAR_STACK();
  class wxPen* r INIT_NULLED_OUT;
  objscheme_check_valid(obj);
  if ((n >= 1) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    float x1;
    int x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, r);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("find-or-create-pen in pen-list% (color% case)", 3, 3, n, p));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0], "find-or-create-pen in pen-list% (color% case)", 0));
    x1 = WITH_VAR_STACK(objscheme_unbundle_float_in(p[1], 0, 255, "find-or-create-pen in pen-list% (color% case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[2], "find-or-create-pen in pen-list% (color% case)"));

    
    r = WITH_VAR_STACK(((wxPenList *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreatePen(x0, x1, x2));

    
    
  } else  {
    string x0 INIT_NULLED_OUT;
    float x1;
    int x2;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, r);
    VAR_STACK_PUSH(3, x0);

    
    if (n != 3) 
      WITH_VAR_STACK(scheme_wrong_count("find-or-create-pen in pen-list% (color name case)", 3, 3, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "find-or-create-pen in pen-list% (color name case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_float_in(p[1], 0, 255, "find-or-create-pen in pen-list% (color name case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[2], "find-or-create-pen in pen-list% (color name case)"));

    
    r = WITH_VAR_STACK(((wxPenList *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreatePen(x0, x1, x2));

    
    
  }

  return WITH_REMEMBERED_STACK(objscheme_bundle_wxPen(r));
}

static Scheme_Object *os_wxPenList_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, obj);
  os_wxPenList *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();

  SETUP_VAR_STACK_PRE_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, realobj);

  
  if (n != 0) 
    WITH_VAR_STACK(scheme_wrong_count("initialization in pen-list%", 0, 0, n, p));

  
  realobj = WITH_VAR_STACK(new os_wxPenList CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxPenList());
#endif
  realobj->__gc_external = (void *)obj;
  objscheme_note_creation(obj);
  
  
  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxPenList(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxPenList_class);

  os_wxPenList_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "pen-list%", "object%", os_wxPenList_ConstructScheme, 1));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPenList_class, "find-or-create-pen", os_wxPenListFindOrCreatePen, 3, 3));


  WITH_VAR_STACK(scheme_made_class(os_wxPenList_class));


  Scheme_Object *xcconsttmp INIT_NULLED_OUT;
  xcconsttmp = WITH_VAR_STACK(objscheme_bundle_wxPenList(wxThePenList));
  WITH_VAR_STACK(scheme_install_xc_global("the-pen-list", xcconsttmp, env));
}

int objscheme_istype_wxPenList(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxPenList_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "pen-list% object or " XC_NULL_STR: "pen-list% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxPenList(class wxPenList *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPenList_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxPenList *objscheme_unbundle_wxPenList(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxPenList(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxPenList *)o->primdata;
  else
    return (wxPenList *)o->primdata;
}


// @SYM "char" : wxCURSOR_CHAR
// @SYM "left-button" : wxCURSOR_LEFT_BUTTON
// @SYM "magnifier" : wxCURSOR_MAGNIFIER
// @SYM "middle-button" : wxCURSOR_MIDDLE_BUTTON
// @SYM "no-entry" : wxCURSOR_NO_ENTRY
// @SYM "paint-brush" : wxCURSOR_PAINT_BRUSH
// @SYM "pencil" : wxCURSOR_PENCIL
// @SYM "point-left" : wxCURSOR_POINT_LEFT
// @SYM "point-right" : wxCURSOR_POINT_RIGHT
// @SYM "question-arrow" : wxCURSOR_QUESTION_ARROW
// @SYM "right-button" : wxCURSOR_RIGHT_BUTTON
// @SYM "sizenesw" : wxCURSOR_SIZENESW
// @SYM "sizens" : wxCURSOR_SIZENS
// @SYM "sizenwse" : wxCURSOR_SIZENWSE
// @SYM "sizewe" : wxCURSOR_SIZEWE
// @SYM "sizing" : wxCURSOR_SIZING
// @SYM "spraycan" : wxCURSOR_SPRAYCAN
// @SYM "wait" : wxCURSOR_WAIT
static Scheme_Object *cursor_wxCURSOR_ARROW_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_BULLSEYE_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_CROSS_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_HAND_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_IBEAM_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_WATCH_sym = NULL;

static void init_symset_cursor(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(cursor_wxCURSOR_ARROW_sym);
  cursor_wxCURSOR_ARROW_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("arrow"));
  wxREGGLOB(cursor_wxCURSOR_BULLSEYE_sym);
  cursor_wxCURSOR_BULLSEYE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bullseye"));
  wxREGGLOB(cursor_wxCURSOR_CROSS_sym);
  cursor_wxCURSOR_CROSS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("cross"));
  wxREGGLOB(cursor_wxCURSOR_HAND_sym);
  cursor_wxCURSOR_HAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hand"));
  wxREGGLOB(cursor_wxCURSOR_IBEAM_sym);
  cursor_wxCURSOR_IBEAM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("ibeam"));
  wxREGGLOB(cursor_wxCURSOR_WATCH_sym);
  cursor_wxCURSOR_WATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("watch"));
}

static int unbundle_symset_cursor(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!cursor_wxCURSOR_WATCH_sym) WITH_VAR_STACK(init_symset_cursor());
  if (0) { }
  else if (v == cursor_wxCURSOR_ARROW_sym) { return wxCURSOR_ARROW; }
  else if (v == cursor_wxCURSOR_BULLSEYE_sym) { return wxCURSOR_BULLSEYE; }
  else if (v == cursor_wxCURSOR_CROSS_sym) { return wxCURSOR_CROSS; }
  else if (v == cursor_wxCURSOR_HAND_sym) { return wxCURSOR_HAND; }
  else if (v == cursor_wxCURSOR_IBEAM_sym) { return wxCURSOR_IBEAM; }
  else if (v == cursor_wxCURSOR_WATCH_sym) { return wxCURSOR_WATCH; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "cursor symbol", -1, 0, &v));
  return 0;
}

static int istype_symset_cursor(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!cursor_wxCURSOR_WATCH_sym) WITH_VAR_STACK(init_symset_cursor());
  if (0) { }
  else if (v == cursor_wxCURSOR_ARROW_sym) { return 1; }
  else if (v == cursor_wxCURSOR_BULLSEYE_sym) { return 1; }
  else if (v == cursor_wxCURSOR_CROSS_sym) { return 1; }
  else if (v == cursor_wxCURSOR_HAND_sym) { return 1; }
  else if (v == cursor_wxCURSOR_IBEAM_sym) { return 1; }
  else if (v == cursor_wxCURSOR_WATCH_sym) { return 1; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "cursor symbol", -1, 0, &v));
  return 0;
}





class os_wxCursor : public wxCursor {
 public:

  os_wxCursor CONSTRUCTOR_ARGS((string x0, int x1 = 0, int x2 = 0, int x3 = 0));
#ifndef MZ_PRECISE_GC
  os_wxCursor CONSTRUCTOR_ARGS((int x0));
#endif
  ~os_wxCursor();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxCursor::gcMark() {
  wxCursor::gcMark();
}
void os_wxCursor::gcFixup() {
  wxCursor::gcFixup();
}
#endif

static Scheme_Object *os_wxCursor_class;

os_wxCursor::os_wxCursor CONSTRUCTOR_ARGS((string x0, int x1, int x2, int x3))
CONSTRUCTOR_INIT(: wxCursor(x0, x1, x2, x3))
{
}

#ifndef MZ_PRECISE_GC
os_wxCursor::os_wxCursor CONSTRUCTOR_ARGS((int x0))
CONSTRUCTOR_INIT(: wxCursor(x0))
{
}
#endif

os_wxCursor::~os_wxCursor()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxCursorOk(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxCursor *)((Scheme_Class_Object *)obj)->primdata)->Ok());

  
  
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxCursor_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(2);
  PRE_VAR_STACK_PUSH(0, obj);
  PRE_VAR_STACK_PUSH(1, p);
  os_wxCursor *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= 1) && WITH_REMEMBERED_STACK(istype_symset_cursor(p[0], NULL))) {
    int x0;

    SETUP_VAR_STACK_PRE_REMEMBERED(3);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);

    
    if (n != 1) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in cursor% (symbolic name case)", 1, 1, n, p));
    x0 = WITH_VAR_STACK(unbundle_symset_cursor(p[0], "initialization in cursor% (symbolic name case)"));

    
    realobj = WITH_VAR_STACK(new os_wxCursor CONSTRUCTOR_ARGS((x0)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxCursor(x0));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  } else  {
    string x0 INIT_NULLED_OUT;
    int x1;
    int x2;
    int x3;

    SETUP_VAR_STACK_PRE_REMEMBERED(4);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, obj);
    VAR_STACK_PUSH(2, realobj);
    VAR_STACK_PUSH(3, x0);

    
    if ((n < 1) ||(n > 4)) 
      WITH_VAR_STACK(scheme_wrong_count("initialization in cursor% (pathname case)", 1, 4, n, p));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "initialization in cursor% (pathname case)"));
    if (n > 1) {
      x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[1], "initialization in cursor% (pathname case)"));
    } else
      x1 = 0;
    if (n > 2) {
      x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[2], 0, 10000, "initialization in cursor% (pathname case)"));
    } else
      x2 = 0;
    if (n > 3) {
      x3 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[3], 0, 10000, "initialization in cursor% (pathname case)"));
    } else
      x3 = 0;

    
    realobj = WITH_VAR_STACK(new os_wxCursor CONSTRUCTOR_ARGS((x0, x1, x2, x3)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxCursor(x0, x1, x2, x3));
#endif
    realobj->__gc_external = (void *)obj;
    objscheme_note_creation(obj);
    
    
  }

  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxCursor(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxCursor_class);

  os_wxCursor_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "cursor%", "object%", os_wxCursor_ConstructScheme, 1));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxCursor_class, "ok?", os_wxCursorOk, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxCursor_class));


}

int objscheme_istype_wxCursor(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxCursor_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "cursor% object or " XC_NULL_STR: "cursor% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxCursor_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxCursor(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxCursor *)o->primdata;
  else
    return (wxCursor *)o->primdata;
}


static void *RgnBoundingBox(wxRegion *r)
{
  float x, y, w, h;
  Scheme_Object *a[4];
  SETUP_VAR_STACK(3);
  VAR_STACK_PUSH_ARRAY(0, a, 4);

  WITH_VAR_STACK(r->BoundingBox(&x, &y, &w, &h));
  a[0] = WITH_VAR_STACK(scheme_make_double(x));
  a[1] = WITH_VAR_STACK(scheme_make_double(y));
  a[2] = WITH_VAR_STACK(scheme_make_double(w));
  a[3] = WITH_VAR_STACK(scheme_make_double(h));
  return WITH_VAR_STACK(scheme_values(4, a));
}

#undef l_ADDRESS
#undef l_DEREF
#undef l_TEST
#undef l_POINT
#undef l_TYPE
#undef l_LIST_ITEM_BUNDLE
#undef l_LIST_ITEM_UNBUNDLE
#undef l_MAKE_LIST
#undef l_MAKE_ARRAY
#undef l_EXTRA
#undef l_TERMINATE
#undef l_COPY
#undef l_OKTEST
#undef l_INTTYPE

#define l_ADDRESS &
#define l_DEREF *
#define l_NEWATOMIC 
#define l_NULLOK 0
#define l_TEST , l_NULLOK
#define l_POINT 
#define l_EXTRA 0
#define l_TERMINATE 
#define l_COPY l_COPYDEST.x=l_COPYSRC.x; l_COPYDEST.y=l_COPYSRC.y;
#define l_OKTEST 
#define l_INTTYPE int
#define l_DIRECTMALLOC 0

#define l_TYPE wxPoint
#define l_LIST_ITEM_BUNDLE objscheme_bundle_wxPoint
#define l_LIST_ITEM_UNBUNDLE objscheme_unbundle_wxPoint
#define l_MAKE_LIST __MakewxPointList
#define l_MAKE_ARRAY __MakewxPointArray





static Scheme_Object *l_MAKE_LIST(l_TYPE l_POINT *f, l_INTTYPE c)
{
  Scheme_Object *cdr = scheme_null, *obj;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cdr);

  while (c--) {
    obj = WITH_VAR_STACK(l_LIST_ITEM_BUNDLE(l_ADDRESS f[c]));
    cdr = WITH_VAR_STACK(scheme_make_pair(obj, cdr));
  }
  
  return cdr;
}

static l_TYPE l_POINT *l_MAKE_ARRAY(Scheme_Object *l, l_INTTYPE *c, char *who)
{
  Scheme_Object *orig_l = l;
  int i = 0;
  long len;
  l_TYPE l_POINT *f = NULL;

  SETUP_VAR_STACK(3);
  VAR_STACK_PUSH(0, l);
  VAR_STACK_PUSH(1, orig_l);
  VAR_STACK_PUSH(2, f);

  len = WITH_VAR_STACK(scheme_proper_list_length(l));
  if (len < 0) WITH_VAR_STACK(scheme_wrong_type(who, "proper-list", -1, 0, &l));
  if (c) *c = len;

  if (!(len + l_EXTRA))
    return NULL;

#if l_DIRECTMALLOC
  f = (l_TYPE l_POINT *)WITH_VAR_STACK(GC_malloc_atomic(sizeof(l_TYPE l_POINT) * (len + l_EXTRA)));
#else
  f = WITH_VAR_STACK(new l_NEWATOMIC l_TYPE l_POINT[len + l_EXTRA]);
#endif

  while (!SCHEME_NULLP(l)) {
    if (!SCHEME_LISTP(l)) {
      WITH_VAR_STACK(scheme_arg_mismatch(who, "expected a proper list: ", orig_l));
      return NULL;
    }

#define l_COPYDEST f[i]
#define l_COPYSRC (l_DEREF WITH_VAR_STACK(l_LIST_ITEM_UNBUNDLE(SCHEME_CAR(l), who l_TEST)))

    l_COPY

    l_OKTEST

    i++;

    l = SCHEME_CDR(l);
  }
  l_TERMINATE

  return f;
}



static Scheme_Object *fillKind_wxODDEVEN_RULE_sym = NULL;
static Scheme_Object *fillKind_wxWINDING_RULE_sym = NULL;

static void init_symset_fillKind(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(fillKind_wxODDEVEN_RULE_sym);
  fillKind_wxODDEVEN_RULE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("odd-even"));
  wxREGGLOB(fillKind_wxWINDING_RULE_sym);
  fillKind_wxWINDING_RULE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("winding"));
}

static int unbundle_symset_fillKind(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!fillKind_wxWINDING_RULE_sym) WITH_VAR_STACK(init_symset_fillKind());
  if (0) { }
  else if (v == fillKind_wxODDEVEN_RULE_sym) { return wxODDEVEN_RULE; }
  else if (v == fillKind_wxWINDING_RULE_sym) { return wxWINDING_RULE; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fillKind symbol", -1, 0, &v));
  return 0;
}






  


 


class os_wxRegion : public wxRegion {
 public:

  os_wxRegion CONSTRUCTOR_ARGS((class wxDC* x0));
  ~os_wxRegion();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxRegion::gcMark() {
  wxRegion::gcMark();
}
void os_wxRegion::gcFixup() {
  wxRegion::gcFixup();
}
#endif

static Scheme_Object *os_wxRegion_class;

os_wxRegion::os_wxRegion CONSTRUCTOR_ARGS((class wxDC* x0))
CONSTRUCTOR_INIT(: wxRegion(x0))
{
}

os_wxRegion::~os_wxRegion()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxRegionEmpty(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->Empty());

  
  
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxRegionRgnBoundingBox(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  void* r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(RgnBoundingBox(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)));

  
  
  return ((Scheme_Object *)r);
}

static Scheme_Object *os_wxRegionSubtract(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  class wxRegion* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxRegion(p[0], "subtract in region%", 0));

  if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","subtract"), "provided region's dc does not match this region's dc: ", p[0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->Subtract(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionIntersect(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  class wxRegion* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxRegion(p[0], "intersect in region%", 0));

  if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","intersect"), "provided region's dc does not match this region's dc: ", p[0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->Intersect(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionUnion(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  class wxRegion* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxRegion(p[0], "union in region%", 0));

  if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","union"), "provided region's dc does not match this region's dc: ", p[0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->Union(x0));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetArc(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  float x0;
  float x1;
  nnfloat x2;
  nnfloat x3;
  float x4;
  float x5;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "set-arc in region%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_float(p[1], "set-arc in region%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[2], "set-arc in region%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[3], "set-arc in region%"));
  x4 = WITH_VAR_STACK(objscheme_unbundle_float(p[4], "set-arc in region%"));
  x5 = WITH_VAR_STACK(objscheme_unbundle_float(p[5], "set-arc in region%"));

  
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->SetArc(x0, x1, x2, x3, x4, x5));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetPolygon(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;
  class wxPoint* x1 INIT_NULLED_OUT;
  float x2;
  float x3;
  int x4;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x1);

  
  x1 = NULL;
  if (n > 1) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_float(p[1], "set-polygon in region%"));
  } else
    x2 = 0;
  if (n > 2) {
    x3 = WITH_VAR_STACK(objscheme_unbundle_float(p[2], "set-polygon in region%"));
  } else
    x3 = 0;
  if (n > 3) {
    x4 = WITH_VAR_STACK(unbundle_symset_fillKind(p[3], "set-polygon in region%"));
  } else
    x4 = wxODDEVEN_RULE;

  x1 = WITH_VAR_STACK(__MakewxPointArray((0 < n) ? p[0] : scheme_null, &x0, METHODNAME("region%","set-polygon")));
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->SetPolygon(x0, x1, x2, x3, x4));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetEllipse(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  float x0;
  float x1;
  nnfloat x2;
  nnfloat x3;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "set-ellipse in region%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_float(p[1], "set-ellipse in region%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[2], "set-ellipse in region%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[3], "set-ellipse in region%"));

  
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->SetEllipse(x0, x1, x2, x3));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetRoundedRectangle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  float x0;
  float x1;
  nnfloat x2;
  nnfloat x3;
  float x4;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "set-rounded-rectangle in region%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_float(p[1], "set-rounded-rectangle in region%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[2], "set-rounded-rectangle in region%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[3], "set-rounded-rectangle in region%"));
  if (n > 4) {
    x4 = WITH_VAR_STACK(objscheme_unbundle_float(p[4], "set-rounded-rectangle in region%"));
  } else
    x4 = 20.0;

  
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->SetRoundedRectangle(x0, x1, x2, x3, x4));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetRectangle(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  float x0;
  float x1;
  nnfloat x2;
  nnfloat x3;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_float(p[0], "set-rectangle in region%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_float(p[1], "set-rectangle in region%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[2], "set-rectangle in region%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_float(p[3], "set-rectangle in region%"));

  
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->SetRectangle(x0, x1, x2, x3));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxRegionGetDC(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxDC* r;
  objscheme_check_valid(obj);

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  

  
  r = WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)obj)->primdata)->GetDC());

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxDC(r));
}

static Scheme_Object *os_wxRegion_ConstructScheme(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, obj);
  os_wxRegion *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  class wxDC* x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_PRE_REMEMBERED(4);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, realobj);
  VAR_STACK_PUSH(3, x0);

  
  if (n != 1) 
    WITH_VAR_STACK(scheme_wrong_count("initialization in region%", 1, 1, n, p));
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[0], "initialization in region%", 0));

  
  realobj = WITH_VAR_STACK(new os_wxRegion CONSTRUCTOR_ARGS((x0)));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxRegion(x0));
#endif
  realobj->__gc_external = (void *)obj;
  objscheme_note_creation(obj);
  
  
  ((Scheme_Class_Object *)obj)->primdata = realobj;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(obj, &((Scheme_Class_Object *)obj)->primdata));
  ((Scheme_Class_Object *)obj)->primflag = 1;
  return obj;
}

void objscheme_setup_wxRegion(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxRegion_class);

  os_wxRegion_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "region%", "object%", os_wxRegion_ConstructScheme, 11));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "is-empty?", os_wxRegionEmpty, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "get-bounding-box", os_wxRegionRgnBoundingBox, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "subtract", os_wxRegionSubtract, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "intersect", os_wxRegionIntersect, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "union", os_wxRegionUnion, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-arc", os_wxRegionSetArc, 6, 6));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-polygon", os_wxRegionSetPolygon, 1, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-ellipse", os_wxRegionSetEllipse, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-rounded-rectangle", os_wxRegionSetRoundedRectangle, 4, 5));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-rectangle", os_wxRegionSetRectangle, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "get-dc", os_wxRegionGetDC, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxRegion_class));


}

int objscheme_istype_wxRegion(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxRegion_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "region% object or " XC_NULL_STR: "region% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxRegion(class wxRegion *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxRegion_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxRegion *objscheme_unbundle_wxRegion(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxRegion(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxRegion *)o->primdata;
  else
    return (wxRegion *)o->primdata;
}



#if USE_FONT_NAME_DIRECTORY

static inline int Identity(wxFontNameDirectory *, int v)
{
  return v;
}







class os_wxFontNameDirectory : public wxFontNameDirectory {
 public:

  ~os_wxFontNameDirectory();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxFontNameDirectory::gcMark() {
  wxFontNameDirectory::gcMark();
}
void os_wxFontNameDirectory::gcFixup() {
  wxFontNameDirectory::gcFixup();
}
#endif

static Scheme_Object *os_wxFontNameDirectory_class;
static Scheme_Object *os_wxFontNameDirectory_interface;

os_wxFontNameDirectory::~os_wxFontNameDirectory()
{
    objscheme_destroy(this, (Scheme_Object *)__gc_external);
}

static Scheme_Object *os_wxFontNameDirectoryIdentity(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(unbundle_symset_family(p[0], "find-family-default-font-id in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(Identity(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata), x0));

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontNameDirectoryFindOrCreateFontId(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);
  cstring x0 INIT_NULLED_OUT;
  int x1;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = (cstring)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "find-or-create-font-id in font-name-directory<%>"));
  x1 = WITH_VAR_STACK(unbundle_symset_family(p[1], "find-or-create-font-id in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->FindOrCreateFontId(x0, x1));

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontNameDirectoryGetFamily(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0], "get-family in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->GetFamily(x0));

  
  
  return WITH_REMEMBERED_STACK(bundle_symset_family(r));
}

static Scheme_Object *os_wxFontNameDirectoryGetFontName(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  objscheme_check_valid(obj);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0], "get-face-name in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->GetFontName(x0));

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r));
}

static Scheme_Object *os_wxFontNameDirectoryGetFontId(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  objscheme_check_valid(obj);
  string x0 INIT_NULLED_OUT;
  int x1;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x0);

  
  x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0], "get-font-id in font-name-directory<%>"));
  x1 = WITH_VAR_STACK(unbundle_symset_family(p[1], "get-font-id in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->GetFontId(x0, x1));

  
  
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontNameDirectorySetPostScriptName(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;
  int x1;
  int x2;
  string x3 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x3);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0], "set-post-script-name in font-name-directory<%>"));
  x1 = WITH_VAR_STACK(unbundle_symset_weight(p[1], "set-post-script-name in font-name-directory<%>"));
  x2 = WITH_VAR_STACK(unbundle_symset_style(p[2], "set-post-script-name in font-name-directory<%>"));
  x3 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[3], "set-post-script-name in font-name-directory<%>"));

  
  WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->SetPostScriptName(x0, x1, x2, x3));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxFontNameDirectorySetScreenName(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(obj);
  int x0;
  int x1;
  int x2;
  string x3 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(3);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);
  VAR_STACK_PUSH(2, x3);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0], "set-screen-name in font-name-directory<%>"));
  x1 = WITH_VAR_STACK(unbundle_symset_weight(p[1], "set-screen-name in font-name-directory<%>"));
  x2 = WITH_VAR_STACK(unbundle_symset_style(p[2], "set-screen-name in font-name-directory<%>"));
  x3 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[3], "set-screen-name in font-name-directory<%>"));

  
  WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->SetScreenName(x0, x1, x2, x3));

  
  
  return scheme_void;
}

static Scheme_Object *os_wxFontNameDirectoryGetPostScriptName(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  objscheme_check_valid(obj);
  int x0;
  int x1;
  int x2;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0], "get-post-script-name in font-name-directory<%>"));
  x1 = WITH_VAR_STACK(unbundle_symset_weight(p[1], "get-post-script-name in font-name-directory<%>"));
  x2 = WITH_VAR_STACK(unbundle_symset_style(p[2], "get-post-script-name in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->GetPostScriptName(x0, x1, x2));

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r));
}

static Scheme_Object *os_wxFontNameDirectoryGetScreenName(Scheme_Object *obj, int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  objscheme_check_valid(obj);
  int x0;
  int x1;
  int x2;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, obj);

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0], "get-screen-name in font-name-directory<%>"));
  x1 = WITH_VAR_STACK(unbundle_symset_weight(p[1], "get-screen-name in font-name-directory<%>"));
  x2 = WITH_VAR_STACK(unbundle_symset_style(p[2], "get-screen-name in font-name-directory<%>"));

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)obj)->primdata)->GetScreenName(x0, x1, x2));

  
  
  return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r));
}

void objscheme_setup_wxFontNameDirectory(void *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxFontNameDirectory_class);
  wxREGGLOB(os_wxFontNameDirectory_interface);

  os_wxFontNameDirectory_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "font-name-directory%", "object%", NULL, 9));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "find-family-default-font-id", os_wxFontNameDirectoryIdentity, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "find-or-create-font-id", os_wxFontNameDirectoryFindOrCreateFontId, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-family", os_wxFontNameDirectoryGetFamily, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-face-name", os_wxFontNameDirectoryGetFontName, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-font-id", os_wxFontNameDirectoryGetFontId, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "set-post-script-name", os_wxFontNameDirectorySetPostScriptName, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "set-screen-name", os_wxFontNameDirectorySetScreenName, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-post-script-name", os_wxFontNameDirectoryGetPostScriptName, 3, 3));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-screen-name", os_wxFontNameDirectoryGetScreenName, 3, 3));


  WITH_VAR_STACK(scheme_made_class(os_wxFontNameDirectory_class));

  os_wxFontNameDirectory_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxFontNameDirectory_class, "font-name-directory" "<%>"));

  WITH_VAR_STACK(objscheme_add_global_interface(os_wxFontNameDirectory_interface, "font-name-directory" "<%>", env));

  Scheme_Object *xcconsttmp INIT_NULLED_OUT;
  xcconsttmp = WITH_VAR_STACK(objscheme_bundle_wxFontNameDirectory(wxTheFontNameDirectory));
  WITH_VAR_STACK(scheme_install_xc_global("the-font-name-directory", xcconsttmp, env));
}

int objscheme_istype_wxFontNameDirectory(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (SAME_TYPE(SCHEME_TYPE(obj), scheme_object_type)
      && scheme_is_subclass(((Scheme_Class_Object *)obj)->sclass,          os_wxFontNameDirectory_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "font-name-directory% object or " XC_NULL_STR: "font-name-directory% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxFontNameDirectory(class wxFontNameDirectory *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    return sobj;
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxFontNameDirectory_class));

  obj->primdata = realobj;
  WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  return (Scheme_Object *)obj;
}

class wxFontNameDirectory *objscheme_unbundle_wxFontNameDirectory(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxFontNameDirectory(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(obj));
  if (o->primflag)
    return (os_wxFontNameDirectory *)o->primdata;
  else
    return (wxFontNameDirectory *)o->primdata;
}


#endif
#ifdef MZ_PRECISE_GC
END_XFORM_SKIP;
#endif
