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


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

#include "wx_obj.h"
#include "wx_win.h"
#include "wx_timer.h"
#include "wx_types.h"
#include "wx_stdev.h"
#include "wx_dc.h"
#include "wx_dcps.h"
#include "wx_clipb.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_misc.h"

#ifdef MZ_PRECISE_GC
START_XFORM_SKIP;
#endif

#if !defined(wx_mac)
#define NEWEST_TYPES 1
#else
#define NEWEST_TYPES 0
#endif



extern void *wxsCheckEventspace(char *);




class os_wxTimer : public wxTimer {
 public:

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

#ifdef MZ_PRECISE_GC
void os_wxTimer::gcMark() {
  wxTimer::gcMark();
}
void os_wxTimer::gcFixup() {
  wxTimer::gcFixup();
}
#endif

static Scheme_Object *os_wxTimer_class;

os_wxTimer::os_wxTimer CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxTimer())
{
}

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

static Scheme_Object *os_wxTimerNotify(int n, Scheme_Object *p[]);

void os_wxTimer::Notify()
{
  Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT });
  Scheme_Object *v;
  Scheme_Object *method INIT_NULLED_OUT;
#ifdef MZ_PRECISE_GC
  os_wxTimer *sElF = this;
#endif
  static void *mcache = 0;

  SETUP_VAR_STACK(5);
  VAR_STACK_PUSH(0, method);
  VAR_STACK_PUSH(1, sElF);
  VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0);
  SET_VAR_STACK();

  method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTimer_class, "notify", &mcache);
  if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTimerNotify)) {
    SET_VAR_STACK();
    READY_TO_RETURN; ASSELF wxTimer::Notify();
  } else {
  
  
  p[0] = (Scheme_Object *) ASSELF __gc_external;

  v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p));
  
  
     READY_TO_RETURN;
  }
}

static Scheme_Object *os_wxTimerStop(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxTimer_class);
  objscheme_check_valid(os_wxTimer_class, "stop in timer%", n, p);

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

  

  
  WITH_VAR_STACK(((wxTimer *)((Scheme_Class_Object *)p[0])->primdata)->Stop());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxTimerStart(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxTimer_class);
  objscheme_check_valid(os_wxTimer_class, "start in timer%", n, p);
  int x0;
  Bool x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], 0, 1000000000, "start in timer%"));
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "start in timer%"));
  } else
    x1 = FALSE;

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxTimerNotify(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxTimer_class);
  objscheme_check_valid(os_wxTimer_class, "notify in timer%", n, p);

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

  

  
  if (((Scheme_Class_Object *)p[0])->primflag)
    WITH_VAR_STACK(((os_wxTimer *)((Scheme_Class_Object *)p[0])->primdata)->wxTimer::Notify());
  else
    WITH_VAR_STACK(((wxTimer *)((Scheme_Class_Object *)p[0])->primdata)->Notify());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxTimerInterval(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_wxTimer_class);
  objscheme_check_valid(os_wxTimer_class, "interval in timer%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxTimer *)((Scheme_Class_Object *)p[0])->primdata)->Interval());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *os_wxTimer_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxTimer *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 timer%", POFFSET+0, POFFSET+0, n, p, 1));

  WITH_VAR_STACK(wxsCheckEventspace(METHODNAME("timer%","initialization")));
  realobj = WITH_VAR_STACK(new os_wxTimer CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxTimer());
#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_wxTimer(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxTimer_class);

  os_wxTimer_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "timer%", "object%", (Scheme_Method_Prim *)os_wxTimer_ConstructScheme, 4));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTimer_class, "stop" " method", (Scheme_Method_Prim *)os_wxTimerStop, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTimer_class, "start" " method", (Scheme_Method_Prim *)os_wxTimerStart, 1, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTimer_class, "notify" " method", (Scheme_Method_Prim *)os_wxTimerNotify, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTimer_class, "interval" " method", (Scheme_Method_Prim *)os_wxTimerInterval, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxTimer_class));


  READY_TO_RETURN;
}

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

Scheme_Object *objscheme_bundle_wxTimer(class wxTimer *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_wxTimer_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 wxTimer *objscheme_unbundle_wxTimer(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  obj = objscheme_unwrap(obj, os_wxTimer_class);
  (void)objscheme_istype_wxTimer(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_wxTimer *)o->primdata;
  else
    return (wxTimer *)o->primdata;
}



void AddType(wxClipboardClient *c, char *s) 
{ 
  c->formats->Add(s); 
}

Scheme_Object *GetTypes(wxClipboardClient *c)
{
  wxNode *n = NULL;
  Scheme_Object *first = scheme_null, *last = NULL;
  Scheme_Object *p = NULL, *s = NULL;
    
  SETUP_VAR_STACK(5);
  VAR_STACK_PUSH(0, n);
  VAR_STACK_PUSH(1, first);
  VAR_STACK_PUSH(2, last);
  VAR_STACK_PUSH(3, p);
  VAR_STACK_PUSH(4, s);

  n = WITH_VAR_STACK(c->formats->First());
  for (; n; n = WITH_VAR_STACK(n->Next())) {
    s = WITH_VAR_STACK(scheme_make_utf8_string((char *)n->Data()));
    p = WITH_VAR_STACK(scheme_make_pair(s, scheme_null));
    if (last)
      SCHEME_CDR(last) = p;
    else
      first = p;
    last = p;
  }
  
  READY_TO_RETURN;

  return first;
}

typedef Scheme_Object *Scheme_Object_Ptr;
static int SameClipboardClientEventspace(wxClipboardClient *c, Scheme_Object *es)
{
  return (c->context == es);
}

static int SameClipboardClient(wxClipboard *cb, wxClipboardClient *cc)
{
  return (cb->GetClipboardClient() == cc);
}




// @ "get-clipboard-client" : wxClipboardClient^ GetClipboardClient();



class os_wxClipboard : public wxClipboard {
 public:

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

#ifdef MZ_PRECISE_GC
void os_wxClipboard::gcMark() {
  wxClipboard::gcMark();
}
void os_wxClipboard::gcFixup() {
  wxClipboard::gcFixup();
}
#endif

static Scheme_Object *os_wxClipboard_class;
static Scheme_Object *os_wxClipboard_interface;

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

static Scheme_Object *os_wxClipboardSameClipboardClient(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_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "same-clipboard-client? in clipboard<%>", n, p);
  class wxClipboardClient* 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_wxClipboardClient(p[POFFSET+0], "same-clipboard-client? in clipboard<%>", 0));

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

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

static Scheme_Object *os_wxClipboardGetClipboardBitmap(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_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "get-clipboard-bitmap in clipboard<%>", n, p);
  ExactLong x0;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "get-clipboard-bitmap in clipboard<%>"));

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

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

static Scheme_Object *os_wxClipboardSetClipboardBitmap(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "set-clipboard-bitmap in clipboard<%>", n, p);
  class wxBitmap* x0 INIT_NULLED_OUT;
  ExactLong x1;

  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-clipboard-bitmap in clipboard<%>", 0));
  x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "set-clipboard-bitmap in clipboard<%>"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxClipboardGetClipboardData(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nbstring r;
  p[0] = objscheme_unwrap(p[0], os_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "get-clipboard-data in clipboard<%>", n, p);
  string x0 INIT_NULLED_OUT;
  long _x1;
  long* x1 = &_x1;
  ExactLong x2;

  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-clipboard-data in clipboard<%>"));
  x2 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "get-clipboard-data in clipboard<%>"));

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

  
  
  READY_TO_RETURN;
  return (r ? scheme_make_sized_byte_string(r, _x1, 1) : XC_SCHEME_NULL);
}

static Scheme_Object *os_wxClipboardGetClipboardString(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_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "get-clipboard-string in clipboard<%>", n, p);
  ExactLong x0;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "get-clipboard-string in clipboard<%>"));

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

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

static Scheme_Object *os_wxClipboardSetClipboardString(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "set-clipboard-string in clipboard<%>", n, p);
  string x0 INIT_NULLED_OUT;
  ExactLong 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], "set-clipboard-string in clipboard<%>"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "set-clipboard-string in clipboard<%>"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxClipboardSetClipboardClient(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxClipboard_class);
  objscheme_check_valid(os_wxClipboard_class, "set-clipboard-client in clipboard<%>", n, p);
  class wxClipboardClient* x0 INIT_NULLED_OUT;
  ExactLong x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxClipboardClient(p[POFFSET+0], "set-clipboard-client in clipboard<%>", 0));
  x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "set-clipboard-client in clipboard<%>"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

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

  wxREGGLOB(os_wxClipboard_class);
  wxREGGLOB(os_wxClipboard_interface);

  os_wxClipboard_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "clipboard%", "object%", NULL, 7));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "same-clipboard-client?" " method", (Scheme_Method_Prim *)os_wxClipboardSameClipboardClient, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "get-clipboard-bitmap" " method", (Scheme_Method_Prim *)os_wxClipboardGetClipboardBitmap, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "set-clipboard-bitmap" " method", (Scheme_Method_Prim *)os_wxClipboardSetClipboardBitmap, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "get-clipboard-data" " method", (Scheme_Method_Prim *)os_wxClipboardGetClipboardData, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "get-clipboard-string" " method", (Scheme_Method_Prim *)os_wxClipboardGetClipboardString, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "set-clipboard-string" " method", (Scheme_Method_Prim *)os_wxClipboardSetClipboardString, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "set-clipboard-client" " method", (Scheme_Method_Prim *)os_wxClipboardSetClipboardClient, 2, 2));


  WITH_VAR_STACK(scheme_made_class(os_wxClipboard_class));

  os_wxClipboard_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxClipboard_class, "clipboard" "<%>"));

  WITH_VAR_STACK(objscheme_add_global_interface(os_wxClipboard_interface, "clipboard" "<%>", env));

  READY_TO_RETURN;
}

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

Scheme_Object *objscheme_bundle_wxClipboard(class wxClipboard *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_wxClipboard_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 wxClipboard *objscheme_unbundle_wxClipboard(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  obj = objscheme_unwrap(obj, os_wxClipboard_class);
  (void)objscheme_istype_wxClipboard(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_wxClipboard *)o->primdata;
  else
    return (wxClipboard *)o->primdata;
}


static wxClipboard* wxGetTheClipboard()
{
  return wxTheClipboard;
}

static wxClipboard* wxGetTheXSelection()
{
#ifdef wx_xt
  return wxTheSelection;
#else
  return wxTheClipboard;
#endif
}

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

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

  

  
  r = WITH_VAR_STACK(wxGetTheXSelection());

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

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

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

  

  
  r = WITH_VAR_STACK(wxGetTheClipboard());

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

void objscheme_setup_wxClipboardGlobal(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 *)wxClipboardGlobalwxGetTheXSelection, "get-the-x-selection", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-x-selection", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxClipboardGlobalwxGetTheClipboard, "get-the-clipboard", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-the-clipboard", functmp, env));
  READY_TO_RETURN;
}









class os_wxClipboardClient : public wxClipboardClient {
 public:

  os_wxClipboardClient CONSTRUCTOR_ARGS(());
  ~os_wxClipboardClient();
  nbstring GetData(string x0, long* x1);
  void BeingReplaced();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxClipboardClient::gcMark() {
  wxClipboardClient::gcMark();
}
void os_wxClipboardClient::gcFixup() {
  wxClipboardClient::gcFixup();
}
#endif

static Scheme_Object *os_wxClipboardClient_class;

os_wxClipboardClient::os_wxClipboardClient CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxClipboardClient())
{
}

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

static Scheme_Object *os_wxClipboardClientGetData(int n, Scheme_Object *p[]);

nbstring os_wxClipboardClient::GetData(string x0, long* x1)
{
  Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT });
  Scheme_Object *v;
  Scheme_Object *method INIT_NULLED_OUT;
#ifdef MZ_PRECISE_GC
  os_wxClipboardClient *sElF = this;
#endif
  static void *mcache = 0;

  SETUP_VAR_STACK(6);
  VAR_STACK_PUSH(0, method);
  VAR_STACK_PUSH(1, sElF);
  VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1);
  VAR_STACK_PUSH(5, x0);
  SET_VAR_STACK();

  method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxClipboardClient_class, "get-data", &mcache);
  if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxClipboardClientGetData)) {
    SET_VAR_STACK();
    return NULL;
  } else {
  
  p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_string((char *)x0));
  
  p[0] = (Scheme_Object *) ASSELF __gc_external;

  v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p));
  if (SCHEME_BYTE_STRINGP(v)) (*x1) = SCHEME_BYTE_STRTAG_VAL(v);
  
  {
     nbstring resval;
     resval = (nbstring)WITH_VAR_STACK(objscheme_unbundle_nullable_bstring(v, "get-data in clipboard-client%"", extracting return value"));
     READY_TO_RETURN;
     return resval;
  }
  }
}

static Scheme_Object *os_wxClipboardClientBeingReplaced(int n, Scheme_Object *p[]);

void os_wxClipboardClient::BeingReplaced()
{
  Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT });
  Scheme_Object *v;
  Scheme_Object *method INIT_NULLED_OUT;
#ifdef MZ_PRECISE_GC
  os_wxClipboardClient *sElF = this;
#endif
  static void *mcache = 0;

  SETUP_VAR_STACK(5);
  VAR_STACK_PUSH(0, method);
  VAR_STACK_PUSH(1, sElF);
  VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0);
  SET_VAR_STACK();

  method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxClipboardClient_class, "on-replaced", &mcache);
  if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxClipboardClientBeingReplaced)) {
    SET_VAR_STACK();
    { READY_TO_RETURN; return; }
  } else {
  
  
  p[0] = (Scheme_Object *) ASSELF __gc_external;

  v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p));
  
  
     READY_TO_RETURN;
  }
}

static Scheme_Object *os_wxClipboardClientSameClipboardClientEventspace(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_wxClipboardClient_class);
  objscheme_check_valid(os_wxClipboardClient_class, "same-eventspace? in clipboard-client%", n, p);
  Scheme_Object_Ptr x0 INIT_NULLED_OUT;

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

  
  x0 = p[POFFSET+0];

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

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

static Scheme_Object *os_wxClipboardClientGetTypes(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Scheme_Object* r;
  p[0] = objscheme_unwrap(p[0], os_wxClipboardClient_class);
  objscheme_check_valid(os_wxClipboardClient_class, "get-types in clipboard-client%", n, p);

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

  

  
  r = WITH_VAR_STACK(GetTypes(((wxClipboardClient *)((Scheme_Class_Object *)p[0])->primdata)));

  
  
  READY_TO_RETURN;
  return r;
}

static Scheme_Object *os_wxClipboardClientAddType(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxClipboardClient_class);
  objscheme_check_valid(os_wxClipboardClient_class, "add-type in clipboard-client%", 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], "add-type in clipboard-client%"));

  
  WITH_VAR_STACK(AddType(((wxClipboardClient *)((Scheme_Class_Object *)p[0])->primdata), x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxClipboardClientGetData(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  nbstring r;
  p[0] = objscheme_unwrap(p[0], os_wxClipboardClient_class);
  objscheme_check_valid(os_wxClipboardClient_class, "get-data in clipboard-client%", n, p);
  string x0 INIT_NULLED_OUT;
  long _x1;
  long* x1 = &_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-data in clipboard-client%"));

  
  if (((Scheme_Class_Object *)p[0])->primflag)
    r =  NULL;
  else
    r = WITH_VAR_STACK(((wxClipboardClient *)((Scheme_Class_Object *)p[0])->primdata)->GetData(x0, x1));

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

static Scheme_Object *os_wxClipboardClientBeingReplaced(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxClipboardClient_class);
  objscheme_check_valid(os_wxClipboardClient_class, "on-replaced in clipboard-client%", n, p);

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

  

  
  if (((Scheme_Class_Object *)p[0])->primflag)
    {}
  else
    WITH_VAR_STACK(((wxClipboardClient *)((Scheme_Class_Object *)p[0])->primdata)->BeingReplaced());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxClipboardClient_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxClipboardClient *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 clipboard-client%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxClipboardClient CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxClipboardClient());
#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_wxClipboardClient(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxClipboardClient_class);

  os_wxClipboardClient_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "clipboard-client%", "object%", (Scheme_Method_Prim *)os_wxClipboardClient_ConstructScheme, 5));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "same-eventspace?" " method", (Scheme_Method_Prim *)os_wxClipboardClientSameClipboardClientEventspace, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "get-types" " method", (Scheme_Method_Prim *)os_wxClipboardClientGetTypes, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "add-type" " method", (Scheme_Method_Prim *)os_wxClipboardClientAddType, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "get-data" " method", (Scheme_Method_Prim *)os_wxClipboardClientGetData, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "on-replaced" " method", (Scheme_Method_Prim *)os_wxClipboardClientBeingReplaced, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxClipboardClient_class));


  READY_TO_RETURN;
}

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

Scheme_Object *objscheme_bundle_wxClipboardClient(class wxClipboardClient *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_wxClipboardClient_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 wxClipboardClient *objscheme_unbundle_wxClipboardClient(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  obj = objscheme_unwrap(obj, os_wxClipboardClient_class);
  (void)objscheme_istype_wxClipboardClient(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_wxClipboardClient *)o->primdata;
  else
    return (wxClipboardClient *)o->primdata;
}



static Scheme_Object *psMode_PS_PREVIEW_sym = NULL;
static Scheme_Object *psMode_PS_FILE_sym = NULL;
static Scheme_Object *psMode_PS_PRINTER_sym = NULL;

static void init_symset_psMode(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(psMode_PS_PREVIEW_sym);
  psMode_PS_PREVIEW_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("preview"));
  wxREGGLOB(psMode_PS_FILE_sym);
  psMode_PS_FILE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("file"));
  wxREGGLOB(psMode_PS_PRINTER_sym);
  psMode_PS_PRINTER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("printer"));
}

static int unbundle_symset_psMode(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!psMode_PS_PRINTER_sym) WITH_VAR_STACK(init_symset_psMode());
  if (0) { }
  else if (v == psMode_PS_PREVIEW_sym) { READY_TO_RETURN; return PS_PREVIEW; }
  else if (v == psMode_PS_FILE_sym) { READY_TO_RETURN; return PS_FILE; }
  else if (v == psMode_PS_PRINTER_sym) { READY_TO_RETURN; return PS_PRINTER; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "psMode symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_psMode(int v) {
  if (!psMode_PS_PRINTER_sym) init_symset_psMode();
  switch (v) {
  case PS_PREVIEW: return psMode_PS_PREVIEW_sym;
  case PS_FILE: return psMode_PS_FILE_sym;
  case PS_PRINTER: return psMode_PS_PRINTER_sym;
  default: return NULL;
  }
}


static Scheme_Object *psOrientation_PS_PORTRAIT_sym = NULL;
static Scheme_Object *psOrientation_PS_LANDSCAPE_sym = NULL;

static void init_symset_psOrientation(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(psOrientation_PS_PORTRAIT_sym);
  psOrientation_PS_PORTRAIT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("portrait"));
  wxREGGLOB(psOrientation_PS_LANDSCAPE_sym);
  psOrientation_PS_LANDSCAPE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("landscape"));
}

static int unbundle_symset_psOrientation(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!psOrientation_PS_LANDSCAPE_sym) WITH_VAR_STACK(init_symset_psOrientation());
  if (0) { }
  else if (v == psOrientation_PS_PORTRAIT_sym) { READY_TO_RETURN; return PS_PORTRAIT; }
  else if (v == psOrientation_PS_LANDSCAPE_sym) { READY_TO_RETURN; return PS_LANDSCAPE; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "psOrientation symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_psOrientation(int v) {
  if (!psOrientation_PS_LANDSCAPE_sym) init_symset_psOrientation();
  switch (v) {
  case PS_PORTRAIT: return psOrientation_PS_PORTRAIT_sym;
  case PS_LANDSCAPE: return psOrientation_PS_LANDSCAPE_sym;
  default: return NULL;
  }
}


#ifdef wx_xt
void check_ps_mode(int, Scheme_Object *) {}
#else
void check_ps_mode(int v, Scheme_Object *p)
{
  if ((v == PS_PREVIEW) || (v == PS_PRINTER)) {
    scheme_arg_mismatch(METHODNAME("ps-setup%","set-mode"), 
	"only file mode is allowed for this platform, given: ",
	p);
  }
}
#endif






// @ "get-options" : string GetPrinterOptions();

// @ "set-options" : void SetPrinterOptions(pstring);


class os_wxPrintSetupData : public wxPrintSetupData {
 public:

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

#ifdef MZ_PRECISE_GC
void os_wxPrintSetupData::gcMark() {
  wxPrintSetupData::gcMark();
}
void os_wxPrintSetupData::gcFixup() {
  wxPrintSetupData::gcFixup();
}
#endif

static Scheme_Object *os_wxPrintSetupData_class;

os_wxPrintSetupData::os_wxPrintSetupData CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxPrintSetupData())
{
}

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

static Scheme_Object *os_wxPrintSetupDatacopy(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "copy-from in ps-setup%", n, p);
  class wxPrintSetupData* 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_wxPrintSetupData(p[POFFSET+0], "copy-from in ps-setup%", 0));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->copy(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetMargin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-margin in ps-setup%", n, p);
  nndouble x0;
  nndouble x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "set-margin in ps-setup%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "set-margin in ps-setup%"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetEditorMargin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-editor-margin in ps-setup%", n, p);
  nnlong x0;
  nnlong x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-editor-margin in ps-setup%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "set-editor-margin in ps-setup%"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetLevel2(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-level-2 in ps-setup%", n, p);
  Bool x0;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-level-2 in ps-setup%"));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetLevel2(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPaperName(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-paper-name in ps-setup%", n, p);
  nstring x0 INIT_NULLED_OUT;

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

  
  x0 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[POFFSET+0], "set-paper-name in ps-setup%"));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetPaperName(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrinterTranslation(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-translation in ps-setup%", 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], "set-translation in ps-setup%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-translation in ps-setup%"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrinterScaling(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-scaling in ps-setup%", n, p);
  nndouble x0;
  nndouble x1;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "set-scaling in ps-setup%"));
  x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "set-scaling in ps-setup%"));

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

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrinterOrientation(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-orientation in ps-setup%", n, p);
  int x0;

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

  
  x0 = WITH_VAR_STACK(unbundle_symset_psOrientation(p[POFFSET+0], "set-orientation in ps-setup%"));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetPrinterOrientation(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrinterMode(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-mode in ps-setup%", n, p);
  int x0;

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

  
  x0 = WITH_VAR_STACK(unbundle_symset_psMode(p[POFFSET+0], "set-mode in ps-setup%"));

  WITH_VAR_STACK(check_ps_mode(x0, p[POFFSET+0]));
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetPrinterMode(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrintPreviewCommand(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-preview-command in ps-setup%", 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], "set-preview-command in ps-setup%"));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetPrintPreviewCommand(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrinterFile(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-file in ps-setup%", n, p);
  npathname x0 INIT_NULLED_OUT;

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

  
  x0 = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(p[POFFSET+0], "set-file in ps-setup%"));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetPrinterFile(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataSetPrinterCommand(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "set-command in ps-setup%", 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], "set-command in ps-setup%"));

  
  WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->SetPrinterCommand(x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataGetMargin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-margin in ps-setup%", n, p);
  nndouble _x0;
  nndouble* x0 = &_x0;
  nndouble _x1;
  nndouble* x1 = &_x1;
  Scheme_Object *sbox_tmp;

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

  
      *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-margin in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-margin in ps-setup%"", extracting boxed argument")));
      *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-margin in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-margin in ps-setup%"", extracting boxed argument")));

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

  
  if (n > (POFFSET+0))
    { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } 
  if (n > (POFFSET+1))
    { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } 
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataGetEditorMargin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-editor-margin in ps-setup%", n, p);
  nnlong _x0;
  nnlong* x0 = &_x0;
  nnlong _x1;
  nnlong* x1 = &_x1;
  Scheme_Object *sbox_tmp;

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

  
      *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-editor-margin in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-editor-margin in ps-setup%"", extracting boxed argument")));
      *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-editor-margin in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-editor-margin in ps-setup%"", extracting boxed argument")));

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

  
  if (n > (POFFSET+0))
    { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } 
  if (n > (POFFSET+1))
    { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } 
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataGetLevel2(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_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-level-2 in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetLevel2());

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

static Scheme_Object *os_wxPrintSetupDataGetPaperName(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_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-paper-name in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetPaperName());

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

static Scheme_Object *os_wxPrintSetupDataGetPrinterTranslation(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-translation in ps-setup%", n, p);
  double _x0;
  double* x0 = &_x0;
  double _x1;
  double* x1 = &_x1;
  Scheme_Object *sbox_tmp;

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

  
      *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-translation in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-translation in ps-setup%"", extracting boxed argument")));
      *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-translation in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-translation in ps-setup%"", extracting boxed argument")));

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

  
  if (n > (POFFSET+0))
    { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } 
  if (n > (POFFSET+1))
    { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } 
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataGetPrinterScaling(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-scaling in ps-setup%", n, p);
  nndouble _x0;
  nndouble* x0 = &_x0;
  nndouble _x1;
  nndouble* x1 = &_x1;
  Scheme_Object *sbox_tmp;

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

  
      *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-scaling in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-scaling in ps-setup%"", extracting boxed argument")));
      *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-scaling in ps-setup%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-scaling in ps-setup%"", extracting boxed argument")));

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

  
  if (n > (POFFSET+0))
    { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } 
  if (n > (POFFSET+1))
    { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } 
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPrintSetupDataGetPrinterOrientation(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_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-orientation in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetPrinterOrientation());

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

static Scheme_Object *os_wxPrintSetupDataGetPrinterMode(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_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-mode in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetPrinterMode());

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

static Scheme_Object *os_wxPrintSetupDataGetPrintPreviewCommand(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  string r;
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-preview-command in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetPrintPreviewCommand());

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

static Scheme_Object *os_wxPrintSetupDataGetPrinterFile(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  npathname r;
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-file in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetPrinterFile());

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

static Scheme_Object *os_wxPrintSetupDataGetPrinterCommand(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  string r;
  p[0] = objscheme_unwrap(p[0], os_wxPrintSetupData_class);
  objscheme_check_valid(os_wxPrintSetupData_class, "get-command in ps-setup%", n, p);

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

  

  
  r = WITH_VAR_STACK(((wxPrintSetupData *)((Scheme_Class_Object *)p[0])->primdata)->GetPrinterCommand());

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

static Scheme_Object *os_wxPrintSetupData_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxPrintSetupData *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 ps-setup%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxPrintSetupData CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxPrintSetupData());
#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_wxPrintSetupData(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxPrintSetupData_class);

  os_wxPrintSetupData_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "ps-setup%", "object%", (Scheme_Method_Prim *)os_wxPrintSetupData_ConstructScheme, 23));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "copy-from" " method", (Scheme_Method_Prim *)os_wxPrintSetupDatacopy, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-margin" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetMargin, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-editor-margin" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetEditorMargin, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-level-2" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetLevel2, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-paper-name" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPaperName, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-translation" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrinterTranslation, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-scaling" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrinterScaling, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-orientation" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrinterOrientation, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-mode" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrinterMode, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-preview-command" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrintPreviewCommand, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-file" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrinterFile, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "set-command" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataSetPrinterCommand, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-margin" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetMargin, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-editor-margin" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetEditorMargin, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-level-2" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetLevel2, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-paper-name" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPaperName, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-translation" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrinterTranslation, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-scaling" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrinterScaling, 2, 2));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-orientation" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrinterOrientation, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-mode" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrinterMode, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-preview-command" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrintPreviewCommand, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-file" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrinterFile, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPrintSetupData_class, "get-command" " method", (Scheme_Method_Prim *)os_wxPrintSetupDataGetPrinterCommand, 0, 0));


  WITH_VAR_STACK(scheme_made_class(os_wxPrintSetupData_class));


  READY_TO_RETURN;
}

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

Scheme_Object *objscheme_bundle_wxPrintSetupData(class wxPrintSetupData *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_wxPrintSetupData_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 wxPrintSetupData *objscheme_unbundle_wxPrintSetupData(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  obj = objscheme_unwrap(obj, os_wxPrintSetupData_class);
  (void)objscheme_istype_wxPrintSetupData(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_wxPrintSetupData *)o->primdata;
  else
    return (wxPrintSetupData *)o->primdata;
}


#ifdef MZ_PRECISE_GC
END_XFORM_SKIP;
#endif
static Bool wxCanShowNative()
{
  wxPrintSetupData *pss;
  pss = wxGetThePrintSetupData();
  return pss->CanShowNative();
}
static Bool wxShowNative(wxWindow *w)
{
  wxPrintSetupData *pss;
  pss = wxGetThePrintSetupData();
  return pss->ShowNative(w);
}
#ifdef MZ_PRECISE_GC
START_XFORM_SKIP;
#endif



static Scheme_Object *wxPrintSetupGlobalwxShowNative(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  class wxWindow* x0 INIT_NULLED_OUT;

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

  
  if (n > (0+0)) {
    x0 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[0+0], "show-print-setup in ps-setup%", 1));
  } else
    x0 = NULL;

  if (x0 && !wxSubType(((wxObject *)x0)->__type, wxTYPE_FRAME) && !wxSubType(((wxObject *)x0)->__type, wxTYPE_DIALOG_BOX)) scheme_wrong_type(METHODNAME("ps-setup","show-native"), "frame or dialog box", POFFSET+0, n, p);
  r = WITH_VAR_STACK(wxShowNative(x0));

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

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

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

  

  
  r = WITH_VAR_STACK(wxCanShowNative());

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

void objscheme_setup_wxPrintSetupGlobal(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 *)wxPrintSetupGlobalwxShowNative, "show-print-setup", 0, 1));
  WITH_VAR_STACK(scheme_install_xc_global("show-print-setup", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxPrintSetupGlobalwxCanShowNative, "can-show-print-setup?", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("can-show-print-setup?", functmp, env));
  READY_TO_RETURN;
}


