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


#if defined(_MSC_VER)
# include "wx.h"
#endif
#if defined(OS_X)
# include "common.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)




#define ESCAPE_NO_RET_VAL /*empty*/


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

#ifdef MZ_PRECISE_GC
START_XFORM_SKIP;
#endif

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) { READY_TO_RETURN; return wxDEFAULT; }
  else if (v == family_wxDECORATIVE_sym) { READY_TO_RETURN; return wxDECORATIVE; }
  else if (v == family_wxROMAN_sym) { READY_TO_RETURN; return wxROMAN; }
  else if (v == family_wxSCRIPT_sym) { READY_TO_RETURN; return wxSCRIPT; }
  else if (v == family_wxSWISS_sym) { READY_TO_RETURN; return wxSWISS; }
  else if (v == family_wxMODERN_sym) { READY_TO_RETURN; return wxMODERN; }
  else if (v == family_wxSYSTEM_sym) { READY_TO_RETURN; return wxSYSTEM; }
  else if (v == family_wxSYMBOL_sym) { READY_TO_RETURN; return wxSYMBOL; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "family symbol", -1, 0, &v));
  READY_TO_RETURN;
  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) { READY_TO_RETURN; return 1; }
  else if (v == family_wxDECORATIVE_sym) { READY_TO_RETURN; return 1; }
  else if (v == family_wxROMAN_sym) { READY_TO_RETURN; return 1; }
  else if (v == family_wxSCRIPT_sym) { READY_TO_RETURN; return 1; }
  else if (v == family_wxSWISS_sym) { READY_TO_RETURN; return 1; }
  else if (v == family_wxMODERN_sym) { READY_TO_RETURN; return 1; }
  else if (v == family_wxSYSTEM_sym) { READY_TO_RETURN; return 1; }
  else if (v == family_wxSYMBOL_sym) { READY_TO_RETURN; return 1; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "family symbol", -1, 0, &v));
  READY_TO_RETURN;
  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) { READY_TO_RETURN; return wxNORMAL; }
  else if (v == weight_wxLIGHT_sym) { READY_TO_RETURN; return wxLIGHT; }
  else if (v == weight_wxBOLD_sym) { READY_TO_RETURN; return wxBOLD; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "weight symbol", -1, 0, &v));
  READY_TO_RETURN;
  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) { READY_TO_RETURN; return wxNORMAL; }
  else if (v == style_wxITALIC_sym) { READY_TO_RETURN; return wxITALIC; }
  else if (v == style_wxSLANT_sym) { READY_TO_RETURN; return wxSLANT; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "style symbol", -1, 0, &v));
  READY_TO_RETURN;
  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;
  }
}


static Scheme_Object *smoothing_wxSMOOTHING_DEFAULT_sym = NULL;
static Scheme_Object *smoothing_wxSMOOTHING_PARTIAL_sym = NULL;
static Scheme_Object *smoothing_wxSMOOTHING_ON_sym = NULL;
static Scheme_Object *smoothing_wxSMOOTHING_OFF_sym = NULL;

static void init_symset_smoothing(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(smoothing_wxSMOOTHING_DEFAULT_sym);
  smoothing_wxSMOOTHING_DEFAULT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("default"));
  wxREGGLOB(smoothing_wxSMOOTHING_PARTIAL_sym);
  smoothing_wxSMOOTHING_PARTIAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("partly-smoothed"));
  wxREGGLOB(smoothing_wxSMOOTHING_ON_sym);
  smoothing_wxSMOOTHING_ON_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("smoothed"));
  wxREGGLOB(smoothing_wxSMOOTHING_OFF_sym);
  smoothing_wxSMOOTHING_OFF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unsmoothed"));
}

static int unbundle_symset_smoothing(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!smoothing_wxSMOOTHING_OFF_sym) WITH_VAR_STACK(init_symset_smoothing());
  if (0) { }
  else if (v == smoothing_wxSMOOTHING_DEFAULT_sym) { READY_TO_RETURN; return wxSMOOTHING_DEFAULT; }
  else if (v == smoothing_wxSMOOTHING_PARTIAL_sym) { READY_TO_RETURN; return wxSMOOTHING_PARTIAL; }
  else if (v == smoothing_wxSMOOTHING_ON_sym) { READY_TO_RETURN; return wxSMOOTHING_ON; }
  else if (v == smoothing_wxSMOOTHING_OFF_sym) { READY_TO_RETURN; return wxSMOOTHING_OFF; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "smoothing symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_smoothing(int v) {
  if (!smoothing_wxSMOOTHING_OFF_sym) init_symset_smoothing();
  switch (v) {
  case wxSMOOTHING_DEFAULT: return smoothing_wxSMOOTHING_DEFAULT_sym;
  case wxSMOOTHING_PARTIAL: return smoothing_wxSMOOTHING_PARTIAL_sym;
  case wxSMOOTHING_ON: return smoothing_wxSMOOTHING_ON_sym;
  case wxSMOOTHING_OFF: return smoothing_wxSMOOTHING_OFF_sym;
  default: return NULL;
  }
}


/* 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 = wxNORMAL, int x3 = wxNORMAL, Bool x4 = 0, int x5 = wxSMOOTHING_DEFAULT, Bool x6 = 0));
#endif
#ifndef MZ_PRECISE_GC
  os_wxFont CONSTRUCTOR_ARGS((int x0, cstring x1, int x2, int x3 = wxNORMAL, int x4 = wxNORMAL, Bool x5 = 0, int x6 = wxSMOOTHING_DEFAULT, Bool x7 = 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, int x5, Bool x6))
CONSTRUCTOR_INIT(: wxFont(x0, x1, x2, x3, x4, x5, x6))
{
}
#endif

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

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

static Scheme_Object *os_wxFontScreenGlyphAvailable(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "screen-glyph-exists? in font%", n, p);
  mzchar x0;
  Bool x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_char(p[POFFSET+0], "screen-glyph-exists? in font%"));
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "screen-glyph-exists? in font%"));
  } else
    x1 = FALSE;

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->ScreenGlyphAvailable(x0, x1));

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxFontGetFontId(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-font-id in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetFontId());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontGetSizeInPixels(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-size-in-pixels in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetSizeInPixels());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxFontGetUnderlined(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-underlined in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetUnderlined());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxFontGetSmoothing(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-smoothing in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetSmoothing());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_smoothing(r));
}

static Scheme_Object *os_wxFontGetWeight(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-weight in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetWeight());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_weight(r));
}

static Scheme_Object *os_wxFontGetPointSize(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-point-size in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetPointSize());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontGetStyle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-style in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetStyle());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_style(r));
}

static Scheme_Object *os_wxFontGetFaceString(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-face in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetFaceString());

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

static Scheme_Object *os_wxFontGetFamily(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFont_class);
  objscheme_check_valid(os_wxFont_class, "get-family in font%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxFont *)((Scheme_Class_Object *)p[0])->primdata)->GetFamily());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_family(r));
}

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

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

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

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

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

    
    if ((n < (POFFSET+2)) || (n > (POFFSET+7))) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in font% (family case)", POFFSET+2, POFFSET+7, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], 1, 255, "initialization in font% (family case)"));
    x1 = WITH_VAR_STACK(unbundle_symset_family(p[POFFSET+1], "initialization in font% (family case)"));
    if (n > (POFFSET+2)) {
      x2 = WITH_VAR_STACK(unbundle_symset_style(p[POFFSET+2], "initialization in font% (family case)"));
    } else
      x2 = wxNORMAL;
    if (n > (POFFSET+3)) {
      x3 = WITH_VAR_STACK(unbundle_symset_weight(p[POFFSET+3], "initialization in font% (family case)"));
    } else
      x3 = wxNORMAL;
    if (n > (POFFSET+4)) {
      x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "initialization in font% (family case)"));
    } else
      x4 = 0;
    if (n > (POFFSET+5)) {
      x5 = WITH_VAR_STACK(unbundle_symset_smoothing(p[POFFSET+5], "initialization in font% (family case)"));
    } else
      x5 = wxSMOOTHING_DEFAULT;
    if (n > (POFFSET+6)) {
      x6 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+6], "initialization in font% (family case)"));
    } else
      x6 = 0;

    
    realobj = WITH_VAR_STACK(new os_wxFont CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6)));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxFont(x0, x1, x2, x3, x4, x5, x6));
#endif
    realobj->__gc_external = (void *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else  {

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

    
    if (n != (POFFSET+0)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in font% (no argument case)", POFFSET+0, POFFSET+0, n, p, 1));

    
    realobj = WITH_VAR_STACK(new os_wxFont CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxFont());
#endif
    realobj->__gc_external = (void *)p[0];
    
    
    READY_TO_PRE_RETURN;
  }

  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxFont(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxFont_ConstructScheme, 10));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "screen-glyph-exists?" " method", (Scheme_Method_Prim *)os_wxFontScreenGlyphAvailable, 1, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-font-id" " method", (Scheme_Method_Prim *)os_wxFontGetFontId, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-size-in-pixels" " method", (Scheme_Method_Prim *)os_wxFontGetSizeInPixels, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-underlined" " method", (Scheme_Method_Prim *)os_wxFontGetUnderlined, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-smoothing" " method", (Scheme_Method_Prim *)os_wxFontGetSmoothing, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-weight" " method", (Scheme_Method_Prim *)os_wxFontGetWeight, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-point-size" " method", (Scheme_Method_Prim *)os_wxFontGetPointSize, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-style" " method", (Scheme_Method_Prim *)os_wxFontGetStyle, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-face" " method", (Scheme_Method_Prim *)os_wxFontGetFaceString, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFont_class, "get-family" " method", (Scheme_Method_Prim *)os_wxFontGetFamily, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxFont_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxFont(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxFont_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxFont_class);
  (void)objscheme_istype_wxFont(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  REMEMBER_VAR_STACK();
  class wxFont* r INIT_NULLED_OUT;
  p[0] = objscheme_unwrap(p[0], os_wxFontList_class);
  objscheme_check_valid(os_wxFontList_class, "find-or-create-font in font-list%", n, p);
  if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(istype_symset_family(p[POFFSET+1], NULL))) {
    int x0;
    int x1;
    int x2;
    int x3;
    Bool x4;
    int x5;
    Bool x6;

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

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

    
    r = WITH_VAR_STACK(((wxFontList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateFont(x0, x1, x2, x3, x4, x5, x6));

    
    
    READY_TO_PRE_RETURN;
  } else  {
    int x0;
    cstring x1 INIT_NULLED_OUT;
    int x2;
    int x3;
    int x4;
    Bool x5;
    int x6;
    Bool x7;

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

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

    
    r = WITH_VAR_STACK(((wxFontList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateFont(x0, x1, x2, x3, x4, x5, x6, x7));

    
    
    READY_TO_PRE_RETURN;
  }

  return WITH_REMEMBERED_STACK(objscheme_bundle_wxFont(r));
}

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

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

  
  if (n != (POFFSET+0)) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in font-list%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxFontList CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxFontList());
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxFontList(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxFontList_ConstructScheme, 1));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontList_class, "find-or-create-font" " method", (Scheme_Method_Prim *)os_wxFontListFindOrCreateFont, 2, 8));


  WITH_VAR_STACK(scheme_made_class(os_wxFontList_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxFontList(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxFontList_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxFontList_class);
  (void)objscheme_istype_wxFontList(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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
#ifndef MZ_PRECISE_GC
  os_wxColour CONSTRUCTOR_ARGS((class wxColour* 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

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

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

static Scheme_Object *os_wxColourBlue(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  ubyte r;
  p[0] = objscheme_unwrap(p[0], os_wxColour_class);
  objscheme_check_valid(os_wxColour_class, "blue in color%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)p[0])->primdata)->Blue());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxColourGreen(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  ubyte r;
  p[0] = objscheme_unwrap(p[0], os_wxColour_class);
  objscheme_check_valid(os_wxColour_class, "green in color%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)p[0])->primdata)->Green());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxColourRed(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  ubyte r;
  p[0] = objscheme_unwrap(p[0], os_wxColour_class);
  objscheme_check_valid(os_wxColour_class, "red in color%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)p[0])->primdata)->Red());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxColourSet(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxColour_class);
  objscheme_check_valid(os_wxColour_class, "set in color%", n, p);
  ubyte x0;
  ubyte x1;
  ubyte x2;

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

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

  if (!((wxColour *)((Scheme_Class_Object *)THEOBJ)->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 *)p[0])->primdata)->Set(x0, x1, x2));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxColourOk(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxColour_class);
  objscheme_check_valid(os_wxColour_class, "ok? in color%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxColour *)((Scheme_Class_Object *)p[0])->primdata)->Ok());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxColourCopyFrom(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  p[0] = objscheme_unwrap(p[0], os_wxColour_class);
  objscheme_check_valid(os_wxColour_class, "copy-from in color%", n, p);
  class wxColour* x0 INIT_NULLED_OUT;

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

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

  if (!((wxColour *)((Scheme_Class_Object *)THEOBJ)->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 *)p[0])->primdata)->CopyFrom(x0));

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

static Scheme_Object *os_wxColour_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxColour *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 1))) {
    class wxColour* x0 INIT_NULLED_OUT;

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

    
    if (n != (POFFSET+1)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in color% (color object case)", POFFSET+1, POFFSET+1, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "initialization in color% (color object case)", 1));

    
    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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[POFFSET+0], NULL))) {
    string x0 INIT_NULLED_OUT;

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

    
    if (n != (POFFSET+1)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in color% (color name case)", POFFSET+1, POFFSET+1, n, p, 1));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+0], NULL))) {
    ubyte x0;
    ubyte x1;
    ubyte x2;

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

    
    if (n != (POFFSET+3)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in color% (rgb values case)", POFFSET+3, POFFSET+3, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], 0, 255, "initialization in color% (rgb values case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+1], 0, 255, "initialization in color% (rgb values case)"));
    x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else  {

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

    
    if (n != (POFFSET+0)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in color% (no argument case)", POFFSET+0, POFFSET+0, n, p, 1));

    
    realobj = WITH_VAR_STACK(new os_wxColour CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxColour());
#endif
    realobj->__gc_external = (void *)p[0];
    
    
    READY_TO_PRE_RETURN;
  }

  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxColour(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxColour_ConstructScheme, 6));

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


  WITH_VAR_STACK(scheme_made_class(os_wxColour_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxColour(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxColour_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxColour_class);
  (void)objscheme_istype_wxColour(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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



class os_wxColourDatabase : public wxColourDatabase {
 public:

  ~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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  p[0] = objscheme_unwrap(p[0], os_wxColourDatabase_class);
  objscheme_check_valid(os_wxColourDatabase_class, "find-color in color-database<%>", n, p);
  string x0 INIT_NULLED_OUT;

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

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

  
  r = WITH_VAR_STACK(((wxColourDatabase *)((Scheme_Class_Object *)p[0])->primdata)->FindColour(x0));

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

void objscheme_setup_wxColourDatabase(Scheme_Env *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" " method", (Scheme_Method_Prim *)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));

  READY_TO_RETURN;
}

int objscheme_istype_wxColourDatabase(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxColourDatabase_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxColourDatabase_class);
  (void)objscheme_istype_wxColourDatabase(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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((double x0, double 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((double x0, double x1))
CONSTRUCTOR_INIT(: wxPoint(x0, x1))
{
}
#endif

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

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

  p[0] = objscheme_unwrap(p[0], os_wxPoint_class);
  objscheme_check_valid(os_wxPoint_class, "get-x in point%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-x in point%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  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(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)objscheme_unwrap(p[0], os_wxPoint_class);
  double v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxPoint_class, "set-x in point%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-x in point%", POFFSET+1, POFFSET+1, n, p, 1));

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

  READY_TO_RETURN;
  return scheme_void;
}

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

  p[0] = objscheme_unwrap(p[0], os_wxPoint_class);
  objscheme_check_valid(os_wxPoint_class, "get-y in point%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-y in point%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  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(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)objscheme_unwrap(p[0], os_wxPoint_class);
  double v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxPoint_class, "set-y in point%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-y in point%", POFFSET+1, POFFSET+1, n, p, 1));

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

  READY_TO_RETURN;
  return scheme_void;
}

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

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

    
    if (n != (POFFSET+2)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in point% (xy values case)", POFFSET+2, POFFSET+2, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "initialization in point% (xy values case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else  {

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

    
    if (n != (POFFSET+0)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in point% (no argument case)", POFFSET+0, POFFSET+0, n, p, 1));

    
    realobj = WITH_VAR_STACK(new os_wxPoint CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPoint());
#endif
    realobj->__gc_external = (void *)p[0];
    
    
    READY_TO_PRE_RETURN;
  }

  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxPoint(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxPoint_ConstructScheme, 4));


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

  WITH_VAR_STACK(scheme_made_class(os_wxPoint_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxPoint(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxPoint_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPoint_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxPoint_class);
  (void)objscheme_istype_wxPoint(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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_wxCOLOR_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 Scheme_Object *brushStyle_wxPANEL_PATTERN_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_wxCOLOR_sym);
  brushStyle_wxCOLOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hilite"));
  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"));
  wxREGGLOB(brushStyle_wxPANEL_PATTERN_sym);
  brushStyle_wxPANEL_PATTERN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("panel"));
}

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

static Scheme_Object *bundle_symset_brushStyle(int v) {
  if (!brushStyle_wxPANEL_PATTERN_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 wxCOLOR: return brushStyle_wxCOLOR_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;
  case wxPANEL_PATTERN: return brushStyle_wxPANEL_PATTERN_sym;
  default: return NULL;
  }
}


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_wxCOLOR_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_wxCOLOR_sym);
  penStyle_wxCOLOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hilite"));
  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) { READY_TO_RETURN; return wxTRANSPARENT; }
  else if (v == penStyle_wxSOLID_sym) { READY_TO_RETURN; return wxSOLID; }
  else if (v == penStyle_wxXOR_sym) { READY_TO_RETURN; return wxXOR; }
  else if (v == penStyle_wxCOLOR_sym) { READY_TO_RETURN; return wxCOLOR; }
  else if (v == penStyle_wxDOT_sym) { READY_TO_RETURN; return wxDOT; }
  else if (v == penStyle_wxLONG_DASH_sym) { READY_TO_RETURN; return wxLONG_DASH; }
  else if (v == penStyle_wxSHORT_DASH_sym) { READY_TO_RETURN; return wxSHORT_DASH; }
  else if (v == penStyle_wxDOT_DASH_sym) { READY_TO_RETURN; return wxDOT_DASH; }
  else if (v == penStyle_wxXOR_DOT_sym) { READY_TO_RETURN; return wxXOR_DOT; }
  else if (v == penStyle_wxXOR_LONG_DASH_sym) { READY_TO_RETURN; return wxXOR_LONG_DASH; }
  else if (v == penStyle_wxXOR_SHORT_DASH_sym) { READY_TO_RETURN; return wxXOR_SHORT_DASH; }
  else if (v == penStyle_wxXOR_DOT_DASH_sym) { READY_TO_RETURN; return wxXOR_DOT_DASH; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "penStyle symbol", -1, 0, &v));
  READY_TO_RETURN;
  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 wxCOLOR: return penStyle_wxCOLOR_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;
  }
}








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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxBrush_class);
  objscheme_check_valid(os_wxBrush_class, "set-style in brush%", n, p);
  int x0;

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

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

  if (!((wxBrush *)((Scheme_Class_Object *)THEOBJ)->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 *)p[0])->primdata)->SetStyle(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxBrushGetStyle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxBrush_class);
  objscheme_check_valid(os_wxBrush_class, "get-style in brush%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)p[0])->primdata)->GetStyle());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_brushStyle(r));
}

static Scheme_Object *os_wxBrushSetStipple(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxBrush_class);
  objscheme_check_valid(os_wxBrush_class, "set-stipple in brush%", n, p);
  class wxBitmap* x0 INIT_NULLED_OUT;

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

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

  { if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("brush%","set-stipple"), "bad bitmap: ", p[POFFSET+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[POFFSET+0])); }if (!((wxBrush *)((Scheme_Class_Object *)THEOBJ)->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 *)p[0])->primdata)->SetStipple(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxBrushGetStipple(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxBitmap* r;
  p[0] = objscheme_unwrap(p[0], os_wxBrush_class);
  objscheme_check_valid(os_wxBrush_class, "get-stipple in brush%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)p[0])->primdata)->GetStipple());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r));
}

static Scheme_Object *os_wxBrushSetColour(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxBrush_class);
  objscheme_check_valid(os_wxBrush_class, "set-color in brush%", n, p);
  if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;

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

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

    if (!((wxBrush *)((Scheme_Class_Object *)THEOBJ)->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-color"), "brush", "brush"));
    WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)p[0])->primdata)->SetColour(x0));

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

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

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

    if (!((wxBrush *)((Scheme_Class_Object *)THEOBJ)->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-color"), "brush", "brush"));
    WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)p[0])->primdata)->SetColour(x0));

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

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

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

    if (!((wxBrush *)((Scheme_Class_Object *)THEOBJ)->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-color"), "brush", "brush"));
    WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)p[0])->primdata)->SetColour(x0, x1, x2));

    
    
    READY_TO_PRE_RETURN;
  }

  return scheme_void;
}

static Scheme_Object *os_wxBrushGetColour(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  p[0] = objscheme_unwrap(p[0], os_wxBrush_class);
  objscheme_check_valid(os_wxBrush_class, "get-color in brush%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxBrush *)((Scheme_Class_Object *)p[0])->primdata)->GetColour());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

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

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

    
    if (n != (POFFSET+2)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in brush% (color name case)", POFFSET+2, POFFSET+2, n, p, 1));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "initialization in brush% (color name case)"));
    x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    int x1;

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

    
    if (n != (POFFSET+2)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in brush% (color% case)", POFFSET+2, POFFSET+2, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "initialization in brush% (color% case)", 0));
    x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else  {

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

    
    if (n != (POFFSET+0)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in brush% (no argument case)", POFFSET+0, POFFSET+0, n, p, 1));

    
    realobj = WITH_VAR_STACK(new os_wxBrush CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxBrush());
#endif
    realobj->__gc_external = (void *)p[0];
    
    
    READY_TO_PRE_RETURN;
  }

  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxBrush(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxBrush_ConstructScheme, 6));

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


  WITH_VAR_STACK(scheme_made_class(os_wxBrush_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxBrush(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxBrush_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxBrush_class);
  (void)objscheme_istype_wxBrush(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  REMEMBER_VAR_STACK();
  class wxBrush* r INIT_NULLED_OUT;
  p[0] = objscheme_unwrap(p[0], os_wxBrushList_class);
  objscheme_check_valid(os_wxBrushList_class, "find-or-create-brush in brush-list%", n, p);
  if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    int x1;

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

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

    
    r = WITH_VAR_STACK(((wxBrushList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateBrush(x0, x1));

    
    
    READY_TO_PRE_RETURN;
  } else  {
    string x0 INIT_NULLED_OUT;
    int x1;

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

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

    
    r = WITH_VAR_STACK(((wxBrushList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateBrush(x0, x1));

    
    
    READY_TO_PRE_RETURN;
  }

  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBrush(r));
}

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

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

  
  if (n != (POFFSET+0)) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in brush-list%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxBrushList CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxBrushList());
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxBrushList(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxBrushList_ConstructScheme, 1));

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


  WITH_VAR_STACK(scheme_made_class(os_wxBrushList_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxBrushList(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxBrushList_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

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


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) { READY_TO_RETURN; return wxJOIN_BEVEL; }
  else if (v == join_wxJOIN_MITER_sym) { READY_TO_RETURN; return wxJOIN_MITER; }
  else if (v == join_wxJOIN_ROUND_sym) { READY_TO_RETURN; return wxJOIN_ROUND; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "join symbol", -1, 0, &v));
  READY_TO_RETURN;
  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) { READY_TO_RETURN; return wxCAP_ROUND; }
  else if (v == cap_wxCAP_PROJECTING_sym) { READY_TO_RETURN; return wxCAP_PROJECTING; }
  else if (v == cap_wxCAP_BUTT_sym) { READY_TO_RETURN; return wxCAP_BUTT; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "cap symbol", -1, 0, &v));
  READY_TO_RETURN;
  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, double x1, int x2));
#endif
#ifndef MZ_PRECISE_GC
  os_wxPen CONSTRUCTOR_ARGS((string x0, double 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, double x1, int x2))
CONSTRUCTOR_INIT(: wxPen(x0, x1, x2))
{
}
#endif

#ifndef MZ_PRECISE_GC
os_wxPen::os_wxPen CONSTRUCTOR_ARGS((string x0, double 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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "set-style in pen%", n, p);
  int x0;

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

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

  if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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 *)p[0])->primdata)->SetStyle(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPenGetStyle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "get-style in pen%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->GetStyle());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_penStyle(r));
}

static Scheme_Object *os_wxPenSetStipple(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "set-stipple in pen%", n, p);
  class wxBitmap* x0 INIT_NULLED_OUT;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+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[POFFSET+0]));if (x0 && ((x0->GetWidth() != 8) || (x0->GetHeight() != 8))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("pen%","set-stipple"), "bitmap is not 8x8: ", p[POFFSET+0]));{ if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("pen%","set-stipple"), "bad bitmap: ", p[POFFSET+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[POFFSET+0])); }if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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 *)p[0])->primdata)->SetStipple(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPenGetStipple(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxBitmap* r;
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "get-stipple in pen%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->GetStipple());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r));
}

static Scheme_Object *os_wxPenSetColour(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "set-color in pen%", n, p);
  if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;

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

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

    if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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-color"), "pen", "pen"));
    WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->SetColour(x0));

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

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

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

    if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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-color"), "pen", "pen"));
    WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->SetColour(x0));

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

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

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

    if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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-color"), "pen", "pen"));
    WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->SetColour(x0, x1, x2));

    
    
    READY_TO_PRE_RETURN;
  }

  return scheme_void;
}

static Scheme_Object *os_wxPenGetColour(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColour* r;
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "get-color in pen%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->GetColour());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
}

static Scheme_Object *os_wxPenSetJoin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "set-join in pen%", n, p);
  int x0;

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

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

  if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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-join"), "pen", "pen"));
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->SetJoin(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPenGetJoin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "get-join in pen%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->GetJoin());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_join(r));
}

static Scheme_Object *os_wxPenSetCap(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "set-cap in pen%", n, p);
  int x0;

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

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

  if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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-cap"), "pen", "pen"));
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->SetCap(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPenGetCap(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "get-cap in pen%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->GetCap());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_cap(r));
}

static Scheme_Object *os_wxPenSetWidth(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "set-width in pen%", n, p);
  double x0;

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

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

  if (!((wxPen *)((Scheme_Class_Object *)THEOBJ)->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-width"), "pen", "pen"));
  WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->SetWidth(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPenGetWidthF(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  double r;
  p[0] = objscheme_unwrap(p[0], os_wxPen_class);
  objscheme_check_valid(os_wxPen_class, "get-width in pen%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPen *)((Scheme_Class_Object *)p[0])->primdata)->GetWidthF());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(scheme_make_double(r));
}

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

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

    
    if (n != (POFFSET+3)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in pen% (color name case)", POFFSET+3, POFFSET+3, n, p, 1));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "initialization in pen% (color name case)"));
    x1 = WITH_VAR_STACK(objscheme_unbundle_double_in(p[POFFSET+1], 0, 255, "initialization in pen% (color name case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    double x1;
    int x2;

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

    
    if (n != (POFFSET+3)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in pen% (color% case)", POFFSET+3, POFFSET+3, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "initialization in pen% (color% case)", 0));
    x1 = WITH_VAR_STACK(objscheme_unbundle_double_in(p[POFFSET+1], 0, 255, "initialization in pen% (color% case)"));
    x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else  {

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

    
    if (n != (POFFSET+0)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in pen% (no argument case)", POFFSET+0, POFFSET+0, n, p, 1));

    
    realobj = WITH_VAR_STACK(new os_wxPen CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
    WITH_VAR_STACK(realobj->gcInit_wxPen());
#endif
    realobj->__gc_external = (void *)p[0];
    
    
    READY_TO_PRE_RETURN;
  }

  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxPen(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxPen_ConstructScheme, 12));

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


  WITH_VAR_STACK(scheme_made_class(os_wxPen_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxPen(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxPen_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxPen_class);
  (void)objscheme_istype_wxPen(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  REMEMBER_VAR_STACK();
  class wxPen* r INIT_NULLED_OUT;
  p[0] = objscheme_unwrap(p[0], os_wxPenList_class);
  objscheme_check_valid(os_wxPenList_class, "find-or-create-pen in pen-list%", n, p);
  if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
    class wxColour* x0 INIT_NULLED_OUT;
    double x1;
    int x2;

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

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

    
    r = WITH_VAR_STACK(((wxPenList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreatePen(x0, x1, x2));

    
    
    READY_TO_PRE_RETURN;
  } else  {
    string x0 INIT_NULLED_OUT;
    double x1;
    int x2;

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

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

    
    r = WITH_VAR_STACK(((wxPenList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreatePen(x0, x1, x2));

    
    
    READY_TO_PRE_RETURN;
  }

  return WITH_REMEMBERED_STACK(objscheme_bundle_wxPen(r));
}

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

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

  
  if (n != (POFFSET+0)) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in pen-list%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxPenList CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxPenList());
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxPenList(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxPenList_ConstructScheme, 1));

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


  WITH_VAR_STACK(scheme_made_class(os_wxPenList_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxPenList(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxPenList_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

  obj = objscheme_unwrap(obj, os_wxPenList_class);
  (void)objscheme_istype_wxPenList(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &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 "sizing" : wxCURSOR_SIZING
// @SYM "spraycan" : wxCURSOR_SPRAYCAN
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_SIZENS_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_SIZEWE_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_SIZENESW_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_SIZENWSE_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_WAIT_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_WATCH_sym = NULL;
static Scheme_Object *cursor_wxCURSOR_BLANK_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_SIZENS_sym);
  cursor_wxCURSOR_SIZENS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("size-n/s"));
  wxREGGLOB(cursor_wxCURSOR_SIZEWE_sym);
  cursor_wxCURSOR_SIZEWE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("size-e/w"));
  wxREGGLOB(cursor_wxCURSOR_SIZENESW_sym);
  cursor_wxCURSOR_SIZENESW_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("size-ne/sw"));
  wxREGGLOB(cursor_wxCURSOR_SIZENWSE_sym);
  cursor_wxCURSOR_SIZENWSE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("size-nw/se"));
  wxREGGLOB(cursor_wxCURSOR_WAIT_sym);
  cursor_wxCURSOR_WAIT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("arrow+watch"));
  wxREGGLOB(cursor_wxCURSOR_WATCH_sym);
  cursor_wxCURSOR_WATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("watch"));
  wxREGGLOB(cursor_wxCURSOR_BLANK_sym);
  cursor_wxCURSOR_BLANK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("blank"));
}

static int unbundle_symset_cursor(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!cursor_wxCURSOR_BLANK_sym) WITH_VAR_STACK(init_symset_cursor());
  if (0) { }
  else if (v == cursor_wxCURSOR_ARROW_sym) { READY_TO_RETURN; return wxCURSOR_ARROW; }
  else if (v == cursor_wxCURSOR_BULLSEYE_sym) { READY_TO_RETURN; return wxCURSOR_BULLSEYE; }
  else if (v == cursor_wxCURSOR_CROSS_sym) { READY_TO_RETURN; return wxCURSOR_CROSS; }
  else if (v == cursor_wxCURSOR_HAND_sym) { READY_TO_RETURN; return wxCURSOR_HAND; }
  else if (v == cursor_wxCURSOR_IBEAM_sym) { READY_TO_RETURN; return wxCURSOR_IBEAM; }
  else if (v == cursor_wxCURSOR_SIZENS_sym) { READY_TO_RETURN; return wxCURSOR_SIZENS; }
  else if (v == cursor_wxCURSOR_SIZEWE_sym) { READY_TO_RETURN; return wxCURSOR_SIZEWE; }
  else if (v == cursor_wxCURSOR_SIZENESW_sym) { READY_TO_RETURN; return wxCURSOR_SIZENESW; }
  else if (v == cursor_wxCURSOR_SIZENWSE_sym) { READY_TO_RETURN; return wxCURSOR_SIZENWSE; }
  else if (v == cursor_wxCURSOR_WAIT_sym) { READY_TO_RETURN; return wxCURSOR_WAIT; }
  else if (v == cursor_wxCURSOR_WATCH_sym) { READY_TO_RETURN; return wxCURSOR_WATCH; }
  else if (v == cursor_wxCURSOR_BLANK_sym) { READY_TO_RETURN; return wxCURSOR_BLANK; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "cursor symbol", -1, 0, &v));
  READY_TO_RETURN;
  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_BLANK_sym) WITH_VAR_STACK(init_symset_cursor());
  if (0) { }
  else if (v == cursor_wxCURSOR_ARROW_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_BULLSEYE_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_CROSS_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_HAND_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_IBEAM_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_SIZENS_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_SIZEWE_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_SIZENESW_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_SIZENWSE_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_WAIT_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_WATCH_sym) { READY_TO_RETURN; return 1; }
  else if (v == cursor_wxCURSOR_BLANK_sym) { READY_TO_RETURN; return 1; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "cursor symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}






class os_wxCursor : public wxCursor {
 public:

  os_wxCursor CONSTRUCTOR_ARGS((int x0));
#ifndef MZ_PRECISE_GC
  os_wxCursor CONSTRUCTOR_ARGS((class wxBitmap* x0, class wxBitmap* x1, int x2 = 0, int x3 = 0));
#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((int x0))
CONSTRUCTOR_INIT(: wxCursor(x0))
{
}

#ifndef MZ_PRECISE_GC
os_wxCursor::os_wxCursor CONSTRUCTOR_ARGS((class wxBitmap* x0, class wxBitmap* x1, int x2, int x3))
CONSTRUCTOR_INIT(: wxCursor(x0, x1, x2, x3))
{
}
#endif

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

static Scheme_Object *os_wxCursorOk(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxCursor_class);
  objscheme_check_valid(os_wxCursor_class, "ok? in cursor%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxCursor *)((Scheme_Class_Object *)p[0])->primdata)->Ok());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxCursor_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxCursor *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxBitmap(p[POFFSET+0], NULL, 0))) {
    class wxBitmap* x0 INIT_NULLED_OUT;
    class wxBitmap* x1 INIT_NULLED_OUT;
    int x2;
    int x3;

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

    
    if ((n < (POFFSET+2)) || (n > (POFFSET+4))) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in cursor% (bitmap case)", POFFSET+2, POFFSET+4, n, p, 1));
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "initialization in cursor% (bitmap case)", 0));
    x1 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+1], "initialization in cursor% (bitmap case)", 0));
    if (n > (POFFSET+2)) {
      x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 0, 15, "initialization in cursor% (bitmap case)"));
    } else
      x2 = 0;
    if (n > (POFFSET+3)) {
      x3 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+3], 0, 15, "initialization in cursor% (bitmap case)"));
    } else
      x3 = 0;

    { if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bad bitmap: ", p[POFFSET+0])); if (x0 && BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+0])); }{ if (x0->GetDepth() != 1) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bitmap is not monochrome: ", p[POFFSET+0]));if ((x0->GetWidth() != 16) || (x0->GetHeight() != 16)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bitmap is not 16 pixels by 16 pixels: ", p[POFFSET+0])); }{ if (x1 && !x1->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bad bitmap: ", p[POFFSET+1])); if (x1 && BM_SELECTED(x1)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+1])); }{ if (x1->GetDepth() != 1) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bitmap is not monochrome: ", p[POFFSET+1]));if ((x1->GetWidth() != 16) || (x1->GetHeight() != 16)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("cursor","initialization"), "bitmap is not 16 pixels by 16 pixels: ", p[POFFSET+1])); }
    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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  } else  {
    int x0;

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

    
    if (n != (POFFSET+1)) 
      WITH_VAR_STACK(scheme_wrong_count_m("initialization in cursor% (symbolic name case)", POFFSET+1, POFFSET+1, n, p, 1));
    x0 = WITH_VAR_STACK(unbundle_symset_cursor(p[POFFSET+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 *)p[0];
    
    
    READY_TO_PRE_RETURN;
  }

  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxCursor(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxCursor_ConstructScheme, 1));

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


  WITH_VAR_STACK(scheme_made_class(os_wxCursor_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxCursor(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxCursor_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

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


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

  a[0] = a[1] = a[2] = a[3] = NULL;

  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));
  rt = WITH_VAR_STACK(scheme_values(4, a));
  READY_TO_RETURN;
  return rt;
}

#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 (AtomicGC)
#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 1

#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 = NULL;
  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));
  }
  
  READY_TO_RETURN;

  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)) {
    READY_TO_RETURN;
    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));
      READY_TO_RETURN;
      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

  READY_TO_RETURN;

  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) { READY_TO_RETURN; return wxODDEVEN_RULE; }
  else if (v == fillKind_wxWINDING_RULE_sym) { READY_TO_RETURN; return wxWINDING_RULE; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fillKind symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}


static Scheme_Object *smoothingMode_0_sym = NULL;
static Scheme_Object *smoothingMode_1_sym = NULL;
static Scheme_Object *smoothingMode_2_sym = NULL;

static void init_symset_smoothingMode(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(smoothingMode_0_sym);
  smoothingMode_0_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unsmoothed"));
  wxREGGLOB(smoothingMode_1_sym);
  smoothingMode_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("smoothed"));
  wxREGGLOB(smoothingMode_2_sym);
  smoothingMode_2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("aligned"));
}

static int unbundle_symset_smoothingMode(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!smoothingMode_2_sym) WITH_VAR_STACK(init_symset_smoothingMode());
  if (0) { }
  else if (v == smoothingMode_0_sym) { READY_TO_RETURN; return 0; }
  else if (v == smoothingMode_1_sym) { READY_TO_RETURN; return 1; }
  else if (v == smoothingMode_2_sym) { READY_TO_RETURN; return 2; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "smoothingMode symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_smoothingMode(int v) {
  if (!smoothingMode_2_sym) init_symset_smoothingMode();
  switch (v) {
  case 0: return smoothingMode_0_sym;
  case 1: return smoothingMode_1_sym;
  case 2: return smoothingMode_2_sym;
  default: return NULL;
  }
}








 


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_wxRegionIsInRegion(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "in-region? in region%", n, p);
  double x0;
  double x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "in-region? in region%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "in-region? in region%"));

  
  r = WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->IsInRegion(x0, x1));

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxRegionEmpty(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "is-empty? in region%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->Empty());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxRegionRgnBoundingBox(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  void* r;
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "get-bounding-box in region%", n, p);

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

  

  
  r = WITH_VAR_STACK(RgnBoundingBox(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)));

  
  
  READY_TO_RETURN;
  return ((Scheme_Object *)r);
}

static Scheme_Object *os_wxRegionXor(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "xor in region%", n, p);
  class wxRegion* x0 INIT_NULLED_OUT;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","xor"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","xor"), "provided region's dc does not match this region's dc: ", p[POFFSET+0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->Xor(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSubtract(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "subtract in region%", n, p);
  class wxRegion* x0 INIT_NULLED_OUT;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","subtract"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","subtract"), "provided region's dc does not match this region's dc: ", p[POFFSET+0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->Subtract(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionIntersect(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "intersect in region%", n, p);
  class wxRegion* x0 INIT_NULLED_OUT;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","intersect"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","intersect"), "provided region's dc does not match this region's dc: ", p[POFFSET+0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->Intersect(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionUnion(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "union in region%", n, p);
  class wxRegion* x0 INIT_NULLED_OUT;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","union"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);if (x0->GetDC() != ((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->GetDC()) scheme_arg_mismatch(METHODNAME("region<%>","union"), "provided region's dc does not match this region's dc: ", p[POFFSET+0]);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->Union(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetPath(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "set-path in region%", n, p);
  class wxPath* x0 INIT_NULLED_OUT;
  double x1;
  double x2;
  int x3;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxPath(p[POFFSET+0], "set-path in region%", 0));
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-path in region%"));
  } else
    x1 = 0;
  if (n > (POFFSET+2)) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "set-path in region%"));
  } else
    x2 = 0;
  if (n > (POFFSET+3)) {
    x3 = WITH_VAR_STACK(unbundle_symset_fillKind(p[POFFSET+3], "set-path in region%"));
  } else
    x3 = wxODDEVEN_RULE;

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","set-path"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->SetPath(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetArc(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "set-arc in region%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;
  double x4;
  double x5;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","set-arc"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->SetArc(x0, x1, x2, x3, x4, x5));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetPolygon(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "set-polygon in region%", n, p);
  int x0;
  class wxPoint* x1 INIT_NULLED_OUT;
  double x2;
  double x3;
  int x4;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","set-polygon"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);x1 = WITH_VAR_STACK(__MakewxPointArray((0+POFFSET < n) ? p[POFFSET+0] : scheme_null, &x0, METHODNAME("region%","set-polygon")));
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->SetPolygon(x0, x1, x2, x3, x4));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetEllipse(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "set-ellipse in region%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","set-ellipse"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->SetEllipse(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetRoundedRectangle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "set-rounded-rectangle in region%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;
  double x4;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","set-rounded-rectangle"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);{ if (x4 < -0.5)  WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("region","set-rounded-rectangle"), "radius must be no less than -0.5: ", p[POFFSET+4])); if (x4 > 0) { if (2 * x4 > x2) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("region","set-rounded-rectangle"), "radius is more than half the width: ", p[POFFSET+4])); if (2 * x4 > x3) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("region","set-rounded-rectangle"), "radius is more than half the height: ", p[POFFSET+4])); } }
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->SetRoundedRectangle(x0, x1, x2, x3, x4));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionSetRectangle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "set-rectangle in region%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;

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

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

  if (((wxRegion *)((Scheme_Class_Object *)THEOBJ)->primdata)->locked) scheme_arg_mismatch(METHODNAME("region<%>","set-rectangle"), "cannot mutate region, because it is currently installed as its dc's clipping region: ", THEOBJ);
  WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->SetRectangle(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxRegionGetDC(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxDC* r;
  p[0] = objscheme_unwrap(p[0], os_wxRegion_class);
  objscheme_check_valid(os_wxRegion_class, "get-dc in region%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxRegion *)((Scheme_Class_Object *)p[0])->primdata)->GetDC());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxDC(r));
}

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

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

  
  if (n != (POFFSET+1)) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in region%", POFFSET+1, POFFSET+1, n, p, 1));
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+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 *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

void objscheme_setup_wxRegion(Scheme_Env *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%", (Scheme_Method_Prim *)os_wxRegion_ConstructScheme, 14));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "in-region?" " method", (Scheme_Method_Prim *)os_wxRegionIsInRegion, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "is-empty?" " method", (Scheme_Method_Prim *)os_wxRegionEmpty, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "get-bounding-box" " method", (Scheme_Method_Prim *)os_wxRegionRgnBoundingBox, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "xor" " method", (Scheme_Method_Prim *)os_wxRegionXor, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "subtract" " method", (Scheme_Method_Prim *)os_wxRegionSubtract, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "intersect" " method", (Scheme_Method_Prim *)os_wxRegionIntersect, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "union" " method", (Scheme_Method_Prim *)os_wxRegionUnion, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-path" " method", (Scheme_Method_Prim *)os_wxRegionSetPath, 1, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-arc" " method", (Scheme_Method_Prim *)os_wxRegionSetArc, 6, 6));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-polygon" " method", (Scheme_Method_Prim *)os_wxRegionSetPolygon, 1, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-ellipse" " method", (Scheme_Method_Prim *)os_wxRegionSetEllipse, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-rounded-rectangle" " method", (Scheme_Method_Prim *)os_wxRegionSetRoundedRectangle, 4, 5));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "set-rectangle" " method", (Scheme_Method_Prim *)os_wxRegionSetRectangle, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxRegion_class, "get-dc" " method", (Scheme_Method_Prim *)os_wxRegionGetDC, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxRegion_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxRegion(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxRegion_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

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




static void *PathBoundingBox(wxPath *r)
{
  double x, y, x2, y2;
  Scheme_Object *a[4];
  void *rt;
  SETUP_VAR_STACK(3);
  VAR_STACK_PUSH_ARRAY(0, a, 4);

  a[0] = a[1] = a[2] = a[3] = NULL;

  WITH_VAR_STACK(r->BoundingBox(&x, &y, &x2, &y2));
  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(x2 - x));
  a[3] = WITH_VAR_STACK(scheme_make_double(y2 - y));
  rt = WITH_VAR_STACK(scheme_values(4, a));
  READY_TO_RETURN;
  return rt;
}








class os_wxPath : public wxPath {
 public:

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

#ifdef MZ_PRECISE_GC
void os_wxPath::gcMark() {
  wxPath::gcMark();
}
void os_wxPath::gcFixup() {
  wxPath::gcFixup();
}
#endif

static Scheme_Object *os_wxPath_class;

os_wxPath::os_wxPath CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxPath())
{
}

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

static Scheme_Object *os_wxPathPathBoundingBox(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  void* r;
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "get-bounding-box in dc-path%", n, p);

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

  

  
  r = WITH_VAR_STACK(PathBoundingBox(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)));

  
  
  READY_TO_RETURN;
  return ((Scheme_Object *)r);
}

static Scheme_Object *os_wxPathAddPath(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "append in dc-path%", n, p);
  class wxPath* x0 INIT_NULLED_OUT;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxPath(p[POFFSET+0], "append in dc-path%", 0));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->AddPath(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathReverse(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "reverse in dc-path%", n, p);

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

  

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Reverse());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathRotate(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "rotate in dc-path%", n, p);
  double x0;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "rotate in dc-path%"));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Rotate(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathScale(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "scale in dc-path%", n, p);
  double x0;
  double x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "scale in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scale in dc-path%"));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Scale(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathTranslate(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "translate in dc-path%", n, p);
  double x0;
  double x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "translate in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "translate in dc-path%"));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Translate(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathLines(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "lines in dc-path%", n, p);
  int x0;
  class wxPoint* x1 INIT_NULLED_OUT;
  double x2;
  double x3;

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

  
  x1 = NULL;
  if (n > (POFFSET+1)) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "lines in dc-path%"));
  } else
    x2 = 0;
  if (n > (POFFSET+2)) {
    x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "lines in dc-path%"));
  } else
    x3 = 0;

  if (!((wxPath *)((Scheme_Class_Object *)THEOBJ)->primdata)->IsOpen()) scheme_arg_mismatch(METHODNAME("dc-path%","lines"), "path is not open: ", THEOBJ);x1 = WITH_VAR_STACK(__MakewxPointArray((0+POFFSET < n) ? p[POFFSET+0] : scheme_null, &x0, METHODNAME("path%","lines")));
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Lines(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathEllipse(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "ellipse in dc-path%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "ellipse in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "ellipse in dc-path%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "ellipse in dc-path%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "ellipse in dc-path%"));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Ellipse(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathRoundedRectangle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "rounded-rectangle in dc-path%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;
  double x4;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "rounded-rectangle in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "rounded-rectangle in dc-path%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "rounded-rectangle in dc-path%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "rounded-rectangle in dc-path%"));
  if (n > (POFFSET+4)) {
    x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "rounded-rectangle in dc-path%"));
  } else
    x4 = -0.25;

  { if (x4 < -0.5)  WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc-path%","rounded-rectangle"), "radius must be no less than -0.5: ", p[POFFSET+4])); if (x4 > 0) { if (2 * x4 > x2) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc-path%","rounded-rectangle"), "radius is more than half the width: ", p[POFFSET+4])); if (2 * x4 > x3) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc-path%","rounded-rectangle"), "radius is more than half the height: ", p[POFFSET+4])); } }
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->RoundedRectangle(x0, x1, x2, x3, x4));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathRectangle(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "rectangle in dc-path%", n, p);
  double x0;
  double x1;
  nndouble x2;
  nndouble x3;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "rectangle in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "rectangle in dc-path%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "rectangle in dc-path%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "rectangle in dc-path%"));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Rectangle(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathCurveTo(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "curve-to in dc-path%", n, p);
  double x0;
  double x1;
  double x2;
  double x3;
  double x4;
  double x5;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "curve-to in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "curve-to in dc-path%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "curve-to in dc-path%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "curve-to in dc-path%"));
  x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "curve-to in dc-path%"));
  x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "curve-to in dc-path%"));

  if (!((wxPath *)((Scheme_Class_Object *)THEOBJ)->primdata)->IsOpen()) scheme_arg_mismatch(METHODNAME("dc-path%","curve-to"), "path is not open: ", THEOBJ);
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->CurveTo(x0, x1, x2, x3, x4, x5));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathArc(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "arc in dc-path%", n, p);
  double x0;
  double x1;
  double x2;
  double x3;
  double x4;
  double x5;
  Bool x6;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "arc in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "arc in dc-path%"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "arc in dc-path%"));
  x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "arc in dc-path%"));
  x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "arc in dc-path%"));
  x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "arc in dc-path%"));
  if (n > (POFFSET+6)) {
    x6 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+6], "arc in dc-path%"));
  } else
    x6 = TRUE;

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Arc(x0, x1, x2, x3, x4, x5, x6));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathLineTo(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "line-to in dc-path%", n, p);
  double x0;
  double x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "line-to in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "line-to in dc-path%"));

  if (!((wxPath *)((Scheme_Class_Object *)THEOBJ)->primdata)->IsOpen()) scheme_arg_mismatch(METHODNAME("dc-path%","line-to"), "path is not open: ", THEOBJ);
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->LineTo(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathMoveTo(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "move-to in dc-path%", n, p);
  double x0;
  double x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "move-to in dc-path%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "move-to in dc-path%"));

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->MoveTo(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathIsOpen(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "open? in dc-path%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->IsOpen());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxPathClose(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "close in dc-path%", n, p);

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

  

  if (!((wxPath *)((Scheme_Class_Object *)THEOBJ)->primdata)->IsOpen()) scheme_arg_mismatch(METHODNAME("dc-path%","close"), "path is not open: ", THEOBJ);
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Close());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPathReset(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPath_class);
  objscheme_check_valid(os_wxPath_class, "reset in dc-path%", n, p);

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

  

  
  WITH_VAR_STACK(((wxPath *)((Scheme_Class_Object *)p[0])->primdata)->Reset());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

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

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

  
  if (n != (POFFSET+0)) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in dc-path%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxPath CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxPath());
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
  return scheme_void;
}

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

  wxREGGLOB(os_wxPath_class);

  os_wxPath_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "dc-path%", "object%", (Scheme_Method_Prim *)os_wxPath_ConstructScheme, 17));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "get-bounding-box" " method", (Scheme_Method_Prim *)os_wxPathPathBoundingBox, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "append" " method", (Scheme_Method_Prim *)os_wxPathAddPath, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "reverse" " method", (Scheme_Method_Prim *)os_wxPathReverse, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "rotate" " method", (Scheme_Method_Prim *)os_wxPathRotate, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "scale" " method", (Scheme_Method_Prim *)os_wxPathScale, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "translate" " method", (Scheme_Method_Prim *)os_wxPathTranslate, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "lines" " method", (Scheme_Method_Prim *)os_wxPathLines, 1, 3));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "ellipse" " method", (Scheme_Method_Prim *)os_wxPathEllipse, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "rounded-rectangle" " method", (Scheme_Method_Prim *)os_wxPathRoundedRectangle, 4, 5));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "rectangle" " method", (Scheme_Method_Prim *)os_wxPathRectangle, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "curve-to" " method", (Scheme_Method_Prim *)os_wxPathCurveTo, 6, 6));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "arc" " method", (Scheme_Method_Prim *)os_wxPathArc, 6, 7));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "line-to" " method", (Scheme_Method_Prim *)os_wxPathLineTo, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "move-to" " method", (Scheme_Method_Prim *)os_wxPathMoveTo, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "open?" " method", (Scheme_Method_Prim *)os_wxPathIsOpen, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "close" " method", (Scheme_Method_Prim *)os_wxPathClose, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPath_class, "reset" " method", (Scheme_Method_Prim *)os_wxPathReset, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxPath_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxPath(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxPath_class);
  if (objscheme_is_a(obj, os_wxPath_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "dc-path% object or " XC_NULL_STR: "dc-path% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxPath(class wxPath *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))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPath_class));

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

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

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

  REMEMBER_VAR_STACK();

  obj = objscheme_unwrap(obj, os_wxPath_class);
  (void)objscheme_istype_wxPath(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxPath *)o->primdata;
  else
    return (wxPath *)o->primdata;
}



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(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "find-family-default-font-id in font-name-directory<%>", n, p);
  int x0;

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

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

  
  r = WITH_VAR_STACK(Identity(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata), x0));

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontNameDirectoryFindOrCreateFontId(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "find-or-create-font-id in font-name-directory<%>", n, p);
  cstring x0 INIT_NULLED_OUT;
  int x1;

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

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

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateFontId(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontNameDirectoryGetFamily(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "get-family in font-name-directory<%>", n, p);
  int x0;

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

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

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->GetFamily(x0));

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(bundle_symset_family(r));
}

static Scheme_Object *os_wxFontNameDirectoryGetFontName(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "get-face-name in font-name-directory<%>", n, p);
  int x0;

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

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

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->GetFontName(x0));

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

static Scheme_Object *os_wxFontNameDirectoryGetFontId(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "get-font-id in font-name-directory<%>", n, p);
  string x0 INIT_NULLED_OUT;
  int x1;

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

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

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->GetFontId(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxFontNameDirectorySetPostScriptName(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "set-post-script-name in font-name-directory<%>", n, p);
  int x0;
  int x1;
  int x2;
  string x3 INIT_NULLED_OUT;

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

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

  
  WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->SetPostScriptName(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxFontNameDirectorySetScreenName(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "set-screen-name in font-name-directory<%>", n, p);
  int x0;
  int x1;
  int x2;
  string x3 INIT_NULLED_OUT;

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

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

  
  WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->SetScreenName(x0, x1, x2, x3));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxFontNameDirectoryGetPostScriptName(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "get-post-script-name in font-name-directory<%>", n, p);
  int x0;
  int x1;
  int x2;

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

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

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->GetPostScriptName(x0, x1, x2));

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

static Scheme_Object *os_wxFontNameDirectoryGetScreenName(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nstring r;
  p[0] = objscheme_unwrap(p[0], os_wxFontNameDirectory_class);
  objscheme_check_valid(os_wxFontNameDirectory_class, "get-screen-name in font-name-directory<%>", n, p);
  int x0;
  int x1;
  int x2;

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

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

  
  r = WITH_VAR_STACK(((wxFontNameDirectory *)((Scheme_Class_Object *)p[0])->primdata)->GetScreenName(x0, x1, x2));

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

void objscheme_setup_wxFontNameDirectory(Scheme_Env *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" " method", (Scheme_Method_Prim *)os_wxFontNameDirectoryIdentity, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "find-or-create-font-id" " method", (Scheme_Method_Prim *)os_wxFontNameDirectoryFindOrCreateFontId, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-family" " method", (Scheme_Method_Prim *)os_wxFontNameDirectoryGetFamily, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-face-name" " method", (Scheme_Method_Prim *)os_wxFontNameDirectoryGetFontName, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-font-id" " method", (Scheme_Method_Prim *)os_wxFontNameDirectoryGetFontId, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "set-post-script-name" " method", (Scheme_Method_Prim *)os_wxFontNameDirectorySetPostScriptName, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "set-screen-name" " method", (Scheme_Method_Prim *)os_wxFontNameDirectorySetScreenName, 4, 4));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-post-script-name" " method", (Scheme_Method_Prim *)os_wxFontNameDirectoryGetPostScriptName, 3, 3));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxFontNameDirectory_class, "get-screen-name" " method", (Scheme_Method_Prim *)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));

  READY_TO_RETURN;
}

int objscheme_istype_wxFontNameDirectory(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  obj = objscheme_unwrap(obj, os_wxFontNameDirectory_class);
  if (objscheme_is_a(obj, 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))))
    { READY_TO_RETURN; 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;
  READY_TO_RETURN;
  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();

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


static wxColourDatabase* wxGetTheColourDatabase()
{
 return wxTheColourDatabase;
}

static wxBrushList* wxGetTheBrushList()
{
 return wxTheBrushList;
}

static wxPenList* wxGetThePenList()
{
 return wxThePenList;
}

static wxFontList* wxGetTheFontList()
{
 return wxTheFontList;
}

static wxFontNameDirectory* wxGetTheFontNameDirectory()
{
 return wxTheFontNameDirectory;
}



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

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

  

  
  r = WITH_VAR_STACK(wxGetControlFontSize());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *wxGDIGlobalwxGetTheFontNameDirectory(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxFontNameDirectory* r;

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

  

  
  r = WITH_VAR_STACK(wxGetTheFontNameDirectory());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxFontNameDirectory(r));
}

static Scheme_Object *wxGDIGlobalwxGetTheFontList(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxFontList* r;

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

  

  
  r = WITH_VAR_STACK(wxGetTheFontList());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxFontList(r));
}

static Scheme_Object *wxGDIGlobalwxGetThePenList(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxPenList* r;

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

  

  
  r = WITH_VAR_STACK(wxGetThePenList());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxPenList(r));
}

static Scheme_Object *wxGDIGlobalwxGetTheBrushList(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxBrushList* r;

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

  

  
  r = WITH_VAR_STACK(wxGetTheBrushList());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxBrushList(r));
}

static Scheme_Object *wxGDIGlobalwxGetTheColourDatabase(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxColourDatabase* r;

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

  

  
  r = WITH_VAR_STACK(wxGetTheColourDatabase());

  
  
  READY_TO_RETURN;
  return WITH_REMEMBERED_STACK(objscheme_bundle_wxColourDatabase(r));
}

void objscheme_setup_wxGDIGlobal(Scheme_Env *env)
{
  Scheme_Object *functmp INIT_NULLED_OUT;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGDIGlobalwxGetControlFontSize, "get-control-font-size", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-control-font-size", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGDIGlobalwxGetTheFontNameDirectory, "get-the-font-name-directory", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-font-name-directory", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGDIGlobalwxGetTheFontList, "get-the-font-list", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-font-list", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGDIGlobalwxGetThePenList, "get-the-pen-list", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-pen-list", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGDIGlobalwxGetTheBrushList, "get-the-brush-list", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-brush-list", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGDIGlobalwxGetTheColourDatabase, "get-the-color-database", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-color-database", functmp, env));
  READY_TO_RETURN;
}

