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


#if defined(__GNUC__)
# define MAYBE_UNUSED __attribute__((unused))
#pragma GCC diagnostic ignored "-Wwrite-strings"
#else
# define MAYBE_UNUSED
#endif

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

#include "wx_utils.h"
#include "wx_dialg.h"
#include "wx_cmdlg.h"
#include "wx_timer.h"
#include "wx_dcps.h"
#include "wx_main.h"

#if USE_METAFILE
#include "wx_mf.h"
#endif




#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_glob.h"

#ifdef MZ_PRECISE_GC
START_XFORM_SKIP;
#endif

static void wxsFillPrivateColor(wxDC *dc, wxColour *c)
{
#ifdef wx_x
 ((wxWindowDC *)dc)->FillPrivateColor(c);
#endif
}

#ifdef wx_msw
extern void wxNotifyCancelEndSession();
#endif
static void wxCancelQuit()
{
#ifdef wx_msw
  wxNotifyCancelEndSession();
#endif
}

static void wxsDisplayOrigin(int *x, int *y, Bool flags = FALSE)
{
#ifdef wx_xt
  wxDisplayOrigin(x, y);
#else
  wxDisplayOrigin(x, y, flags);
#endif	
}

#ifndef wxGETDIR
# define wxGETDIR 0
#endif
#ifndef wxBUNDLES_OK
# define wxBUNDLES_OK 0
#endif
#ifndef wxBUNDLES_ENTER
# define wxBUNDLES_ENTER 0
#endif

static Scheme_Object *fileSelMode_wxOPEN_sym = NULL;
static Scheme_Object *fileSelMode_wxSAVE_sym = NULL;
static Scheme_Object *fileSelMode_wxGETDIR_sym = NULL;
static Scheme_Object *fileSelMode_wxMULTIOPEN_sym = NULL;
static Scheme_Object *fileSelMode_wxOVERWRITE_PROMPT_sym = NULL;
static Scheme_Object *fileSelMode_wxHIDE_READONLY_sym = NULL;
static Scheme_Object *fileSelMode_wxBUNDLES_OK_sym = NULL;
static Scheme_Object *fileSelMode_wxBUNDLES_ENTER_sym = NULL;

static void init_symset_fileSelMode(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(fileSelMode_wxOPEN_sym);
  fileSelMode_wxOPEN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("get"));
  wxREGGLOB(fileSelMode_wxSAVE_sym);
  fileSelMode_wxSAVE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("put"));
  wxREGGLOB(fileSelMode_wxGETDIR_sym);
  fileSelMode_wxGETDIR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("dir"));
  wxREGGLOB(fileSelMode_wxMULTIOPEN_sym);
  fileSelMode_wxMULTIOPEN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("multi"));
  wxREGGLOB(fileSelMode_wxOVERWRITE_PROMPT_sym);
  fileSelMode_wxOVERWRITE_PROMPT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("overwrite-prompt"));
  wxREGGLOB(fileSelMode_wxHIDE_READONLY_sym);
  fileSelMode_wxHIDE_READONLY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hide-readonly"));
  wxREGGLOB(fileSelMode_wxBUNDLES_OK_sym);
  fileSelMode_wxBUNDLES_OK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("packages"));
  wxREGGLOB(fileSelMode_wxBUNDLES_ENTER_sym);
  fileSelMode_wxBUNDLES_ENTER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("enter-packages"));
}

MAYBE_UNUSED static int unbundle_symset_fileSelMode(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!fileSelMode_wxBUNDLES_ENTER_sym) WITH_VAR_STACK(init_symset_fileSelMode());
  Scheme_Object *i INIT_NULLED_OUT, *l = v;
  long result = 0;
  while (SCHEME_PAIRP(l)) {
  i = SCHEME_CAR(l);
  if (0) { }
  else if (i == fileSelMode_wxOPEN_sym) { result = result | wxOPEN; }
  else if (i == fileSelMode_wxSAVE_sym) { result = result | wxSAVE; }
  else if (i == fileSelMode_wxGETDIR_sym) { result = result | wxGETDIR; }
  else if (i == fileSelMode_wxMULTIOPEN_sym) { result = result | wxMULTIOPEN; }
  else if (i == fileSelMode_wxOVERWRITE_PROMPT_sym) { result = result | wxOVERWRITE_PROMPT; }
  else if (i == fileSelMode_wxHIDE_READONLY_sym) { result = result | wxHIDE_READONLY; }
  else if (i == fileSelMode_wxBUNDLES_OK_sym) { result = result | wxBUNDLES_OK; }
  else if (i == fileSelMode_wxBUNDLES_ENTER_sym) { result = result | wxBUNDLES_ENTER; }
  else { break; } 
  l = SCHEME_CDR(l);
  }
  if (SCHEME_NULLP(l)) { READY_TO_RETURN; return result; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fileSelMode symbol list", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

MAYBE_UNUSED static int istype_symset_fileSelMode(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!fileSelMode_wxBUNDLES_ENTER_sym) WITH_VAR_STACK(init_symset_fileSelMode());
  Scheme_Object *i INIT_NULLED_OUT, *l = v;
  long result = 1;
  while (SCHEME_PAIRP(l)) {
  i = SCHEME_CAR(l);
  if (0) { }
  else if (i == fileSelMode_wxOPEN_sym) { ; }
  else if (i == fileSelMode_wxSAVE_sym) { ; }
  else if (i == fileSelMode_wxGETDIR_sym) { ; }
  else if (i == fileSelMode_wxMULTIOPEN_sym) { ; }
  else if (i == fileSelMode_wxOVERWRITE_PROMPT_sym) { ; }
  else if (i == fileSelMode_wxHIDE_READONLY_sym) { ; }
  else if (i == fileSelMode_wxBUNDLES_OK_sym) { ; }
  else if (i == fileSelMode_wxBUNDLES_ENTER_sym) { ; }
  else { break; } 
  l = SCHEME_CDR(l);
  }
  if (SCHEME_NULLP(l)) { READY_TO_RETURN; return result; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fileSelMode symbol list", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

MAYBE_UNUSED static Scheme_Object *bundle_symset_fileSelMode(int v) {
  REMEMBER_VAR_STACK();
  if (!fileSelMode_wxBUNDLES_ENTER_sym) init_symset_fileSelMode();
  Scheme_Object *l = scheme_null;
  if (v & wxOPEN) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxOPEN_sym, l));
  if (v & wxSAVE) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxSAVE_sym, l));
  if (v & wxGETDIR) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxGETDIR_sym, l));
  if (v & wxMULTIOPEN) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxMULTIOPEN_sym, l));
  if (v & wxOVERWRITE_PROMPT) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxOVERWRITE_PROMPT_sym, l));
  if (v & wxHIDE_READONLY) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxHIDE_READONLY_sym, l));
  if (v & wxBUNDLES_OK) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxBUNDLES_OK_sym, l));
  if (v & wxBUNDLES_ENTER) l = WITH_REMEMBERED_STACK(scheme_make_pair(fileSelMode_wxBUNDLES_ENTER_sym, l));
  return l;
}


#define USE_PRINTER 1

extern void *wxSchemeYield(void *sema);

extern void wxFlushDisplay(void);

#ifdef wx_x
# define FILE_SEL_DEF_PATTERN "*"
#else
# define FILE_SEL_DEF_PATTERN "*.*"
#endif

static char *wxStripMenuCodes_Scheme(char *in)
{
  static char *buffer = NULL;
  static long buflen = 0;
  long len;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, in);

  len = strlen(in);
  if (buflen <= len) {
    if (!buffer)
      wxREGGLOB(buffer);
    buflen = 2 * len + 1;
    buffer = (char *)WITH_VAR_STACK(GC_malloc_atomic(buflen));
  }

  WITH_VAR_STACK(wxStripMenuCodes(in, buffer));
  READY_TO_RETURN;
  return buffer;
}

#ifdef wx_xt
extern void wxBell(void);
#endif


extern int objscheme_istype_wxFrame(Scheme_Object *obj, const char *stop, int nullOK);
extern class wxFrame *objscheme_unbundle_wxFrame(Scheme_Object *obj, const char *where, int nullOK);
extern int objscheme_istype_wxDialogBox(Scheme_Object *obj, const char *stop, int nullOK);
extern class wxDialogBox *objscheme_unbundle_wxDialogBox(Scheme_Object *obj, const char *where, int nullOK);











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

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

  

  
  WITH_VAR_STACK(wxCancelQuit());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *wxsGlobalwxsFillPrivateColor(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  class wxDC* x0 INIT_NULLED_OUT;
  class wxColour* x1 INIT_NULLED_OUT;

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

  
  x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[0+0], "fill-private-color", 0));
  x1 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[0+1], "fill-private-color", 0));

  
  WITH_VAR_STACK(wxsFillPrivateColor(x0, x1));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

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

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

  

  
  WITH_VAR_STACK(wxFlushDisplay());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *wxsGlobalwxSchemeYield(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  void* r;
  void* x0 INIT_NULLED_OUT;

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

  
  if (n > (0+0)) {
    x0 = (void *)p[0+0];
  } else
    x0 = NULL;

  
  r = WITH_VAR_STACK(wxSchemeYield(x0));

  
  
  READY_TO_RETURN;
  return (Scheme_Object *)r;
}

static Scheme_Object *wxsGlobalwxWriteResource(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();
  Bool r;
  if ((n >= (0+3)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0+1], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0+2], NULL))) {
    string x0 INIT_NULLED_OUT;
    string x1 INIT_NULLED_OUT;
    string x2 INIT_NULLED_OUT;
    wnpathname x3 INIT_NULLED_OUT;

    SETUP_VAR_STACK_PRE_REMEMBERED(5);
    VAR_STACK_PUSH(0, p);
    VAR_STACK_PUSH(1, x0);
    VAR_STACK_PUSH(2, x1);
    VAR_STACK_PUSH(3, x2);
    VAR_STACK_PUSH(4, x3);

    
    if ((n < (0+3)) || (n > (0+4))) 
      WITH_VAR_STACK(scheme_wrong_count_m("write-resource (string case)", 0+3, 0+4, n, p, 0));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+0], "write-resource (string case)"));
    x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+1], "write-resource (string case)"));
    x2 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+2], "write-resource (string case)"));
    if (n > (0+3)) {
      x3 = (wnpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_write_pathname(p[0+3], "write-resource (string case)"));
    } else
      x3 = NULL;

    
    r = WITH_VAR_STACK(wxWriteResource(x0, x1, x2, x3));

    
    
    READY_TO_PRE_RETURN;
  } else  {
    string x0 INIT_NULLED_OUT;
    string x1 INIT_NULLED_OUT;
    ExactLong x2;
    wnpathname x3 INIT_NULLED_OUT;

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

    
    if ((n < (0+3)) || (n > (0+4))) 
      WITH_VAR_STACK(scheme_wrong_count_m("write-resource (number case)", 0+3, 0+4, n, p, 0));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+0], "write-resource (number case)"));
    x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+1], "write-resource (number case)"));
    x2 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[0+2], "write-resource (number case)"));
    if (n > (0+3)) {
      x3 = (wnpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_write_pathname(p[0+3], "write-resource (number case)"));
    } else
      x3 = NULL;

    
    r = WITH_VAR_STACK(wxWriteResource(x0, x1, x2, x3));

    
    
    READY_TO_PRE_RETURN;
  }

  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *wxsGlobalwxGetResource(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();
  Bool r;
  if ((n >= (0+3)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[0+1], NULL)) && (WITH_REMEMBERED_STACK(objscheme_istype_box(p[0+2], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_string(objscheme_unbox(p[0+2], NULL), NULL)))) {
    string x0 INIT_NULLED_OUT;
    string x1 INIT_NULLED_OUT;
    string _x2;
    string* x2 = &_x2;
    npathname x3 INIT_NULLED_OUT;
  Scheme_Object *sbox_tmp;

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

    
    if ((n < (0+3)) || (n > (0+4))) 
      WITH_VAR_STACK(scheme_wrong_count_m("get-resource (string case)", 0+3, 0+4, n, p, 0));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+0], "get-resource (string case)"));
    x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+1], "get-resource (string case)"));
          *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+2], "get-resource (string case)")), (string)WITH_VAR_STACK(objscheme_unbundle_string(sbox_tmp, "get-resource (string case)"", extracting boxed argument")));
    if (n > (0+3)) {
      x3 = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(p[0+3], "get-resource (string case)"));
    } else
      x3 = NULL;

    
    r = WITH_VAR_STACK(wxGetResource(x0, x1, x2, x3));

    
    if (n > (0+2))
      { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_string((char *)_x2)); WITH_VAR_STACK(objscheme_set_box(p[0+2], sbv_)); } 
    
    READY_TO_PRE_RETURN;
  } else  {
    string x0 INIT_NULLED_OUT;
    string x1 INIT_NULLED_OUT;
    long _x2;
    long* x2 = &_x2;
    npathname x3 INIT_NULLED_OUT;
  Scheme_Object *sbox_tmp;

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

    
    if ((n < (0+3)) || (n > (0+4))) 
      WITH_VAR_STACK(scheme_wrong_count_m("get-resource (number case)", 0+3, 0+4, n, p, 0));
    x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+0], "get-resource (number case)"));
    x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+1], "get-resource (number case)"));
          *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+2], "get-resource (number case)")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "get-resource (number case)"", extracting boxed argument")));
    if (n > (0+3)) {
      x3 = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(p[0+3], "get-resource (number case)"));
    } else
      x3 = NULL;

    
    r = WITH_VAR_STACK(wxGetResource(x0, x1, x2, x3));

    
    if (n > (0+2))
      { Scheme_Object *sbv_ = scheme_make_integer(_x2); WITH_VAR_STACK(objscheme_set_box(p[0+2], sbv_)); } 
    
    READY_TO_PRE_RETURN;
  }

  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *wxsGlobalwxStripMenuCodes_Scheme(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  string r;
  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[0+0], "label->plain-label"));

  
  r = WITH_VAR_STACK(wxStripMenuCodes_Scheme(x0));

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

static Scheme_Object *wxsGlobalwxsDisplayOrigin(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int _x0;
  int* x0 = &_x0;
  int _x1;
  int* x1 = &_x1;
  Bool x2;
  Scheme_Object *sbox_tmp;

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

  
      *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+0], "display-origin")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-origin"", extracting boxed argument")));
      *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+1], "display-origin")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-origin"", extracting boxed argument")));
  if (n > (0+2)) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[0+2], "display-origin"));
  } else
    x2 = FALSE;

  
  WITH_VAR_STACK(wxsDisplayOrigin(x0, x1, x2));

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

static Scheme_Object *wxsGlobalwxDisplaySize(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int _x0;
  int* x0 = &_x0;
  int _x1;
  int* x1 = &_x1;
  int x2;
  Scheme_Object *sbox_tmp;

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

  
      *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+0], "display-size")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-size"", extracting boxed argument")));
      *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[0+1], "display-size")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "display-size"", extracting boxed argument")));
  x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0+2], "display-size"));

  
  WITH_VAR_STACK(wxDisplaySize(x0, x1, x2));

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

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

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

  

  
  WITH_VAR_STACK(wxBell());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

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

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

  

  
  WITH_VAR_STACK(wxHideCursor());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

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

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

  

  
  WITH_VAR_STACK(wxEndBusyCursor());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *wxsGlobalwxIsBusy(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(wxIsBusy());

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

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

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

  

  
  WITH_VAR_STACK(wxBeginBusyCursor());

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *wxsGlobalwxDisplayDepth(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(wxDisplayDepth());

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

static Scheme_Object *wxsGlobalwxColourDisplay(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(wxColourDisplay());

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

static Scheme_Object *wxsGlobalwxFileSelector(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  npathname r;
  nstring x0 INIT_NULLED_OUT;
  npathname x1 INIT_NULLED_OUT;
  nxpathname x2 INIT_NULLED_OUT;
  nstring x3 INIT_NULLED_OUT;
  nstring x4 INIT_NULLED_OUT;
  int x5;
  class wxWindow* x6 INIT_NULLED_OUT;
  int x7;
  int x8;

  SETUP_VAR_STACK_REMEMBERED(7);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, x0);
  VAR_STACK_PUSH(2, x1);
  VAR_STACK_PUSH(3, x2);
  VAR_STACK_PUSH(4, x3);
  VAR_STACK_PUSH(5, x4);
  VAR_STACK_PUSH(6, x6);

  
  x0 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[0+0], "file-selector"));
  if (n > (0+1)) {
    x1 = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(p[0+1], "file-selector"));
  } else
    x1 = NULL;
  if (n > (0+2)) {
    x2 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[0+2], "file-selector"));
  } else
    x2 = NULL;
  if (n > (0+3)) {
    x3 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[0+3], "file-selector"));
  } else
    x3 = NULL;
  if (n > (0+4)) {
    x4 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[0+4], "file-selector"));
  } else
    x4 = FILE_SEL_DEF_PATTERN;
  if (n > (0+5)) {
    x5 = WITH_VAR_STACK(unbundle_symset_fileSelMode(p[0+5], "file-selector"));
  } else
    x5 = wxOPEN;
  x6 = (((n <= 0) || XC_SCHEME_NULLP(p[0+6])) ? (wxWindow *)NULL : (WITH_VAR_STACK(objscheme_istype_wxFrame(p[0+6], NULL, 1)) ? (wxWindow *)WITH_VAR_STACK(objscheme_unbundle_wxFrame(p[0+6], NULL, 0)) : (WITH_VAR_STACK(objscheme_istype_wxDialogBox(p[0+6], NULL, 1)) ? (wxWindow *)WITH_VAR_STACK(objscheme_unbundle_wxDialogBox(p[0+6], NULL, 0)) : (WITH_VAR_STACK(scheme_wrong_type("file-selector", "frame% or dialog%", -1, 0, &p[0+6])), (wxWindow *)NULL))));
  if (n > (0+7)) {
    x7 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0+7], "file-selector"));
  } else
    x7 = -1;
  if (n > (0+8)) {
    x8 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0+8], "file-selector"));
  } else
    x8 = -1;

  
  r = WITH_VAR_STACK(wxFileSelector(x0, x1, x2, x3, x4, x5, x6, x7, x8));

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

void objscheme_setup_wxsGlobal(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 *)wxsGlobalwxCancelQuit, "cancel-quit", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("cancel-quit", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxsFillPrivateColor, "fill-private-color", 2, 2));
  WITH_VAR_STACK(scheme_install_xc_global("fill-private-color", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxFlushDisplay, "flush-display", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("flush-display", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxSchemeYield, "yield", 0, 1));
  WITH_VAR_STACK(scheme_install_xc_global("yield", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxWriteResource, "write-resource", 3, 4));
  WITH_VAR_STACK(scheme_install_xc_global("write-resource", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxGetResource, "get-resource", 3, 4));
  WITH_VAR_STACK(scheme_install_xc_global("get-resource", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxStripMenuCodes_Scheme, "label->plain-label", 1, 1));
  WITH_VAR_STACK(scheme_install_xc_global("label->plain-label", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxsDisplayOrigin, "display-origin", 2, 3));
  WITH_VAR_STACK(scheme_install_xc_global("display-origin", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxDisplaySize, "display-size", 3, 3));
  WITH_VAR_STACK(scheme_install_xc_global("display-size", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxBell, "bell", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("bell", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxHideCursor, "hide-cursor", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("hide-cursor", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxEndBusyCursor, "end-busy-cursor", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("end-busy-cursor", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxIsBusy, "is-busy?", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("is-busy?", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxBeginBusyCursor, "begin-busy-cursor", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("begin-busy-cursor", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxDisplayDepth, "get-display-depth", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("get-display-depth", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxColourDisplay, "is-color-display?", 0, 0));
  WITH_VAR_STACK(scheme_install_xc_global("is-color-display?", functmp, env));
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsGlobalwxFileSelector, "file-selector", 1, 9));
  WITH_VAR_STACK(scheme_install_xc_global("file-selector", functmp, env));
  READY_TO_RETURN;
}

