Back to index

plt-scheme  4.2.1
Classes | Defines | Typedefs | Functions | Variables
mred.cxx File Reference
#include "common.h"
#include "wx_frame.h"
#include "wx_utils.h"
#include "wx_main.h"
#include "wx_buttn.h"
#include "wx_messg.h"
#include "wx_timer.h"
#include "wx_dialg.h"
#include "wx_cmdlg.h"
#include "wx_menu.h"
#include "wx_dcps.h"
#include "wx_clipb.h"
#include "wx_types.h"
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "wxs/wxscheme.h"
#include "wxs/wxsmred.h"
#include "wxs/wxs_fram.h"
#include "wxs/wxs_obj.h"
#include "mred.h"

Go to the source code of this file.

Classes

class  MrEdApp
struct  Nested_Wait
struct  Context_Custodian_Hop
class  MrEd_Saved_Modal
struct  Q_Callback
struct  Q_Callback_Set

Defines

#define Uses_XtIntrinsic
#define Uses_XtIntrinsicP
#define Uses_XLib
#define wx_in_terminal   0
#define ADD_OBJ_DUMP   0
#define INTERRUPT_CHECK_ON   0
#define CAST_SCP   /* empty */
#define CAST_GCP   /* empty */
#define CAST_SCCC   /* empty */
#define CAST_BLKCHK   /* empty */
#define CAST_WU   /* empty */
#define CAST_TOK   /* empty */
#define CAST_GS   /* empty */
#define CAST_IREADY   /* empty */
#define CAST_ICLOSE   /* empty */
#define CAST_WS   /* empty */
#define CAST_MK   /* empty */
#define CAST_SLEEP   /* empty */
#define CAST_IGNORE   /* empty */
#define CAST_PRINTF   /* empty */
#define CAST_OUTPUT   /* empty */
#define CAST_EXIT   /* empty */
#define CAST_DW_PRE   /* empty */
#define CAST_DW_RUN   /* empty */
#define CAST_DW_POST   /* empty */
#define CAST_SUSPEND   /* empty */
#define CAST_EXT   /* empty */
#define WEAKIFY(x)   x
#define WEAKIFIED(x)   x
#define HIDE_FROM_XFORM(x)   x
#define KEEP_GOING   wxTheApp->keep_going
#define mrerr   stderr

Typedefs

typedef struct Nested_Wait Nested_Wait
typedef struct
Context_Custodian_Hop 
Context_Custodian_Hop
typedef struct Q_Callback Q_Callback
typedef void(* OOM_ptr )(void)

Functions

void wxMouseEventHandled (void)
void mred_set_finish_cmd_line_run (MrEd_Finish_Cmd_Line_Run_Proc p)
void mred_set_run_from_cmd_line (MrEd_Run_From_Cmd_Line_Proc p)
static MrEdContextcheck_q_callbacks (int hi, int(*test)(MrEdContext *, MrEdContext *), MrEdContext *tdata, int check_only)
static void remove_q_callbacks (MrEdContext *c)
MrEdContextMrEdGetContext (wxObject *w)
voidMrEdGetWindowContext (wxWindow *w)
voidwxGetContextForFrame ()
wxChildListwxGetTopLevelWindowsList (wxObject *w)
wxWindowwxGetModalWindow (wxObject *w)
void wxPushModalWindow (wxObject *w, wxWindow *win)
void wxPopModalWindow (wxObject *w, wxWindow *win)
int wxGetBusyState (void)
void wxSetBusyState (int state)
int MrEdGetDoubleTime (void)
int wxMrEdGetDoubleTime (void)
Bool wxIsPrimEventspace ()
int wxIsUserMainEventspace (Scheme_Object *o)
int wxsIsContextShutdown (void *cx)
voidwxsCheckEventspace (char *who)
wxPrintSetupData * wxGetThePrintSetupData ()
void wxSetThePrintSetupData (wxPrintSetupData *d)
static int MrEdSameContext (MrEdContext *c, MrEdContext *testc)
static void destroy_wxObject (wxWindow *w, void *)
static void kill_eventspace (Scheme_Object *ec, void *)
static Scheme_Objectextract_eventspace_from_hop (Scheme_Object *ec)
static void CollectingContext (void *cfx, void *)
static MrEdContextMakeContext (MrEdContext *c)
static void ChainContextsList ()
static void UnchainContextsList ()
static wxTimerGlobalFirstTimer ()
Scheme_ObjectMrEdMakeEventspace ()
Scheme_ObjectMrEdEventspaceThread (Scheme_Object *e)
Scheme_ObjectMrEdGetFrameList (void)
voidMrEdForEachFrame (ForEachFrameProc fp, void *data)
static int check_eventspace_inactive (void *_c)
void mred_wait_eventspace (void)
int mred_current_thread_is_handler (void *ctx)
int mred_in_restricted_context ()
static wxTimerTimerReady (MrEdContext *c)
static void DoTimer (wxTimer *timer)
static int do_check_for_nested_event (Scheme_Object *cx)
static int check_for_nested_event (Scheme_Object *cx)
static void GoAhead (MrEdContext *c)
static Scheme_Objectdef_event_dispatch_handler (int argc, Scheme_Object *argv[])
static void DoTheEvent (MrEdContext *c)
static void reset_nested_wait (MrEdContext *c)
static Scheme_ObjectMrEdDoNextEvent (MrEdContext *c, wxDispatch_Check_Fun alt, void *altdata, Scheme_Object *alt_wait)
void wxDoNextEvent ()
int MrEdEventReady (MrEdContext *c)
int wxEventReady ()
static void WaitForAnEvent_OrDie (MrEdContext *c)
static void on_handler_killed (Scheme_Thread *p)
static Scheme_Objecthandle_events (void *cx, int, Scheme_Object **)
static int MrEdContextReady (MrEdContext *, MrEdContext *c)
static void event_found (MrEdContext *c)
static int try_q_callback (Scheme_Object *do_it, int hi)
static int try_dispatch (Scheme_Object *do_it)
static void wakeup_on_dispatch (Scheme_Object *, void *fds)
static int check_initialized (Scheme_Object *)
void wxDoEvents ()
Scheme_ObjectwxDispatchEventsUntilWaitable (wxDispatch_Check_Fun f, void *data, Scheme_Object *w)
void wxDispatchEventsUntil (wxDispatch_Check_Fun f, void *data)
void wxBlockUntil (wxDispatch_Check_Fun f, void *data)
void wxBlockUntilTimeout (wxDispatch_Check_Fun f, void *data, float timeout)
static void MrEdSleep (float secs, void *fds)
static void insert_q_callback (Q_Callback_Set *cs, Q_Callback *cb)
static void remove_q_callback (Q_Callback_Set *cs, Q_Callback *cb)
static void call_one_callback (Q_Callback *volatile cb)
void MrEd_add_q_callback (char *who, int argc, Scheme_Object **argv)
static Scheme_Objectcall_being_replaced (void *d, int, Scheme_Object **argv)
void MrEdQueueBeingReplaced (wxClipboardClient *clipOwner)
void MrEdQueueInEventspace (void *context, Scheme_Object *thunk)
void wxmeError (const char *e)
static void MrEdOutOfMemory (void)
voidwxOutOfMemory ()
static void not_so_much_memory (void)
voidwxMallocAtomicIfPossible (size_t s)
static void MrEdIgnoreWarnings (char *, GC_word)
void wxDoMainLoop ()
static Scheme_Envsetup_basic_env ()
static void on_main_killed (Scheme_Thread *p)
void wxCreateApp (void)
void wxFlushDisplay (void)
static void wxDo (Scheme_Object *proc, int argc, Scheme_Object **argv)
void wxDrop_Runtime (char **argv, int argc)

Variables

wxFramemred_real_main_frame
static Scheme_Threaduser_main_thread
MrEd_Finish_Cmd_Line_Run_Proc mred_finish_cmd_line_run
MrEd_Run_From_Cmd_Line_Proc mred_run_from_cmd_line
static Scheme_Envglobal_env
MrEdAppTheMrEdApp
static int exit_val = 0
MrEdContextmred_contexts
static MrEdContextmred_main_context
static MrEdContextmred_only_context
static int only_context_just_once = 0
static MrEdContextuser_main_context
static MrEdContextFramesRef mred_frames
static Scheme_Hash_Tabletimer_contexts
int mred_eventspace_param
int mred_event_dispatch_param
Scheme_Type mred_eventspace_type
Scheme_Type mred_nested_wait_type
static Scheme_Type mred_eventspace_hop_type
static Scheme_Objectdef_dispatch
int mred_ps_setup_param
static int doubleClickThreshold = -1
static int ps_ready = 0
static wxPrintSetupData * orig_ps_setup
static SLEEP_PROC_PTR mzsleep
static Q_Callback_Set q_callbacks [3]
Scheme_ObjectMrEd_mid_queue_key
MZ_EXTERN void(* GC_out_of_memory )(void)
static OOM_ptr mr_save_oom
static mz_jmp_buf oom_buf

Class Documentation

struct Nested_Wait

Definition at line 257 of file mred.cxx.

Collaboration diagram for Nested_Wait:
Class Members
Scheme_Object so
Scheme_Object * wait_on
struct Context_Custodian_Hop

Definition at line 262 of file mred.cxx.

Collaboration diagram for Context_Custodian_Hop:
Class Members
MrEdContext * context
Scheme_Object so
class MrEd_Saved_Modal

Definition at line 473 of file mred.cxx.

Collaboration diagram for MrEd_Saved_Modal:
Class Members
MrEd_Saved_Modal * next
wxWindow * win
struct Q_Callback

Definition at line 1884 of file mred.cxx.

Collaboration diagram for Q_Callback:
Class Members
Scheme_Object * callback
MrEdContext * context
struct Q_Callback * next
struct Q_Callback * prev
struct Q_Callback_Set

Definition at line 1893 of file mred.cxx.

Collaboration diagram for Q_Callback_Set:
Class Members
Q_Callback * first
Q_Callback * last

Define Documentation

#define ADD_OBJ_DUMP   0

Definition at line 100 of file mred.cxx.

#define CAST_BLKCHK   /* empty */

Definition at line 166 of file mred.cxx.

#define CAST_DW_POST   /* empty */

Definition at line 181 of file mred.cxx.

#define CAST_DW_PRE   /* empty */

Definition at line 179 of file mred.cxx.

#define CAST_DW_RUN   /* empty */

Definition at line 180 of file mred.cxx.

#define CAST_EXIT   /* empty */

Definition at line 178 of file mred.cxx.

#define CAST_EXT   /* empty */

Definition at line 183 of file mred.cxx.

#define CAST_GCP   /* empty */

Definition at line 164 of file mred.cxx.

#define CAST_GS   /* empty */

Definition at line 169 of file mred.cxx.

#define CAST_ICLOSE   /* empty */

Definition at line 171 of file mred.cxx.

#define CAST_IGNORE   /* empty */

Definition at line 175 of file mred.cxx.

#define CAST_IREADY   /* empty */

Definition at line 170 of file mred.cxx.

#define CAST_MK   /* empty */

Definition at line 173 of file mred.cxx.

#define CAST_OUTPUT   /* empty */

Definition at line 177 of file mred.cxx.

#define CAST_PRINTF   /* empty */

Definition at line 176 of file mred.cxx.

#define CAST_SCCC   /* empty */

Definition at line 165 of file mred.cxx.

#define CAST_SCP   /* empty */

Definition at line 163 of file mred.cxx.

#define CAST_SLEEP   /* empty */

Definition at line 174 of file mred.cxx.

#define CAST_SUSPEND   /* empty */

Definition at line 182 of file mred.cxx.

#define CAST_TOK   /* empty */

Definition at line 168 of file mred.cxx.

#define CAST_WS   /* empty */

Definition at line 172 of file mred.cxx.

#define CAST_WU   /* empty */

Definition at line 167 of file mred.cxx.

#define HIDE_FROM_XFORM (   x)    x

Definition at line 273 of file mred.cxx.

#define INTERRUPT_CHECK_ON   0

Definition at line 103 of file mred.cxx.

#define KEEP_GOING   wxTheApp->keep_going

Definition at line 1611 of file mred.cxx.

#define mrerr   stderr

Definition at line 2270 of file mred.cxx.

#define Uses_XLib

Definition at line 13 of file mred.cxx.

Definition at line 11 of file mred.cxx.

Definition at line 12 of file mred.cxx.

#define WEAKIFIED (   x)    x

Definition at line 272 of file mred.cxx.

#define WEAKIFY (   x)    x

Definition at line 271 of file mred.cxx.

#define wx_in_terminal   0

Definition at line 89 of file mred.cxx.


Typedef Documentation

typedef void(* OOM_ptr)(void)

Definition at line 2920 of file mred.cxx.


Function Documentation

static Scheme_Object* call_being_replaced ( void d,
int  ,
Scheme_Object **  argv 
) [static]

Definition at line 2168 of file mred.cxx.

{
  wxClipboardClient *clipOwner = (wxClipboardClient *)d;
  clipOwner->BeingReplaced();
  return scheme_void;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void call_one_callback ( Q_Callback *volatile  cb) [static]

Definition at line 1933 of file mred.cxx.

{
  mz_jmp_buf *save, newbuf;
  Scheme_Thread *thread;
  thread = scheme_get_current_thread();

  save = thread->error_buf;
  thread->error_buf = &newbuf;
  if (!scheme_setjmp(newbuf))
    scheme_apply_multi(cb->callback, 0, NULL);
  scheme_clear_escape();
  thread = scheme_get_current_thread();
  thread->error_buf = save;
}

Here is the caller graph for this function:

static void ChainContextsList ( ) [static]

Definition at line 803 of file mred.cxx.

{
  MrEdContextFrames *f;
  MrEdContextFramesRef fr = mred_frames;
  wxChildNode *first;

  mred_contexts = NULL;

  while (fr) {
    f = FRAMES_REF(fr);
    first = f->list->First();

#if 0
    while (first && !first->IsShown())
      first = first->Next();
#endif

    if (first) {
      wxObject *o;
      MrEdContext *c;
      o = first->Data();
      c = MrEdGetContext(o);
      c->next = mred_contexts;
      mred_contexts = c;
    }
    fr = f->next;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int check_eventspace_inactive ( void _c) [static]

Definition at line 971 of file mred.cxx.

{
  MrEdContext *c = (MrEdContext *)_c;

  if (c->nested_avail)
    return 0;

  /* Any callbacks prepared for this eventspace? */
  if (check_q_callbacks(0, MrEdSameContext, c, 1)
      || check_q_callbacks(1, MrEdSameContext, c, 1)
      || check_q_callbacks(2, MrEdSameContext, c, 1))
    return 0;

  /* Any running timers for the eventspace? */
  if (c->timers)
    return 0;

  /* Any top-level windows visible in this eventspace */
  {
    MrEdContextFrames *f = c->finalized->frames;
    wxChildNode *node;

    node = f->list->First();

    while (node) {
      if (node->IsShown()) {
       return 0;
      }
      node = node->Next();
    }
  }

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int check_for_nested_event ( Scheme_Object cx) [static]

Definition at line 1117 of file mred.cxx.

{
  return do_check_for_nested_event(((Nested_Wait *)cx)->wait_on);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int check_initialized ( Scheme_Object ) [static]

Definition at line 1606 of file mred.cxx.

{
  return TheMrEdApp->initialized;
}

Here is the caller graph for this function:

static MrEdContext * check_q_callbacks ( int  hi,
int(*)(MrEdContext *, MrEdContext *)  test,
MrEdContext tdata,
int  check_only 
) [static]

Definition at line 1948 of file mred.cxx.

{
  Q_Callback_Set *cs = q_callbacks + hi;
  Q_Callback *cb;

  cb = cs->first;
  while (cb) {
    if (test(tdata, cb->context)) {
      if (check_only)
       return cb->context;

      remove_q_callback(cs, cb);

      call_one_callback(cb);

      return cb->context;
    }
    cb = cb->next;
  }

  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void CollectingContext ( void cfx,
void  
) [static]

Definition at line 673 of file mred.cxx.

{
  wxChildNode *cnode, *next;
  MrEdFinalizedContext *cf;
  cf = (MrEdFinalizedContext *)gcPTR_TO_OBJ(cfx);

  if (cf->frames->next)
    FRAMES_REF(cf->frames->next)->prev = cf->frames->prev;
  if (cf->frames->prev)
    FRAMES_REF(cf->frames->prev)->next = cf->frames->next;
  else
    mred_frames = cf->frames->next;

  cf->frames->next = NULL;
  cf->frames->prev = NULL;

  /* Must explicitly delete frames now because their context
     is going away. (The frame would certainly have been finalized
     later during this set of finalizations, but that would be
     too late.) */
  for (cnode = cf->frames->list->First(); cnode; cnode = next) {
    wxFrame *fr;
    next = cnode->Next();
    fr = (wxFrame *)cnode->Data();
    if (fr) {
      DELETE_OBJ fr;
    }
  }

  MrEdDestroyContext(cf);

  DELETE_OBJ cf->frames->list;
  cf->frames = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Scheme_Object* def_event_dispatch_handler ( int  argc,
Scheme_Object argv[] 
) [static]

Definition at line 1159 of file mred.cxx.

{
  MrEdContext *c;

  c = (MrEdContext *)argv[0];
  if (!SAME_TYPE(SCHEME_TYPE(argv[0]), mred_eventspace_type)
      || !c->ready_to_go) {
    scheme_wrong_type("default-event-dispatch-handler",
                    "eventspace (with ready event)",
                    0, argc, argv);
    return NULL;
  }

  GoAhead(c);

  return scheme_void;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void destroy_wxObject ( wxWindow w,
void  
) [static]

Definition at line 617 of file mred.cxx.

{
  if (w->__gc_external) {
    objscheme_destroy(w, (Scheme_Object *)w->__gc_external);
    ((Scheme_Class_Object *)w->__gc_external)->primflag = -2; /* -2 => shutdown */
    w->__gc_external = NULL;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_check_for_nested_event ( Scheme_Object cx) [static]

Definition at line 1101 of file mred.cxx.

{
  MrEdContext *c = (MrEdContext *)cx;

  if (!c->waiting_for_nested)
    return 1;

  if (c->alternate) {
    if (c->alternate(c->alt_data))
      return 1;

    return 0;
  } else
    return 0;
}

Here is the caller graph for this function:

static void DoTheEvent ( MrEdContext c) [static]

Definition at line 1177 of file mred.cxx.

{
  Scheme_Object *p;

  c->ready_to_go = 1;

  p = scheme_get_param(scheme_current_config(), mred_event_dispatch_param);
  if (p != def_dispatch) {
    Scheme_Object *a[1];
    mz_jmp_buf *save, newbuf;
    Scheme_Thread *thread;
    thread = scheme_get_current_thread();

    a[0] = (Scheme_Object *)c;

    save = thread->error_buf;
    thread->error_buf = &newbuf;
    if (!scheme_setjmp(newbuf))
      scheme_apply_multi(p, 1, a);
    scheme_clear_escape();
    thread = scheme_get_current_thread();
    thread->error_buf = save;
    thread = NULL;

#if 0
    if (c->ready_to_go)
      printf("Bad dispatcher\n");
#endif
  }

  if (c->ready_to_go)
    GoAhead(c);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void DoTimer ( wxTimer timer) [static]

Definition at line 1074 of file mred.cxx.

{
  int once;
  mz_jmp_buf *save, newbuf;
  Scheme_Thread *thread;
  thread = scheme_get_current_thread();

  if (timer->interval == -1)
    return;

  once = timer->one_shot;
  timer->one_shot = -1;

  save = thread->error_buf;
  thread->error_buf = &newbuf;
  if (!scheme_setjmp(newbuf))
    timer->Notify();
  scheme_clear_escape();
  thread = scheme_get_current_thread();
  thread->error_buf = save;
  thread = NULL;

  if (!once && (timer->one_shot == -1) && (timer->interval != -1)
      && !((MrEdContext *)timer->context)->killed)
    timer->Start(timer->interval, FALSE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void event_found ( MrEdContext c) [static]

Definition at line 1476 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 668 of file mred.cxx.

{
  return (Scheme_Object *)WEAKIFIED(((Context_Custodian_Hop *)ec)->context);
}

Here is the caller graph for this function:

static wxTimer* GlobalFirstTimer ( ) [static]

Definition at line 841 of file mred.cxx.

{
  wxTimer *timer = NULL;
  int i;
  for (i = timer_contexts->size; i--; ) {
    if (timer_contexts->vals[i]) {
      MrEdContext *c = (MrEdContext *)timer_contexts->keys[i];
      if (c->ready && c->timers) {
        if (!timer)
          timer = c->timers;
        else if (c->timers->expiration < timer->expiration)
          timer = c->timers;
      }
    }
  }
  return timer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void GoAhead ( MrEdContext c) [static]

Definition at line 1127 of file mred.cxx.

{
  c->ready_to_go = 0;

  if (c->q_callback) {
    int hi = (c->q_callback - 1);
    c->q_callback = 0;
    (void)check_q_callbacks(hi, MrEdSameContext, c, 0);
  } else if (c->timer) {
    wxTimer *timer;
    timer = c->timer;
    c->timer = NULL;
    DoTimer(timer);
  } else {
    GC_CAN_IGNORE MrEdEvent e;
    mz_jmp_buf *save, newbuf;
    Scheme_Thread *thread;
    thread = scheme_get_current_thread();

    memcpy(&e, &c->event, sizeof(MrEdEvent));

    save = thread->error_buf;
    thread->error_buf = &newbuf;
    if (!scheme_setjmp(newbuf))
      MrEdDispatchEvent(&e);
    scheme_clear_escape();
    thread = scheme_get_current_thread();
    thread->error_buf = save;
    thread = NULL;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Scheme_Object* handle_events ( void cx,
int  ,
Scheme_Object **   
) [static]

Definition at line 1421 of file mred.cxx.

{
  MrEdContext *c = (MrEdContext *)cx;
  Scheme_Thread *this_thread;
  mz_jmp_buf newbuf;

#if SGC_STD_DEBUGGING
  fprintf(stderr, "new thread\n");
#endif

  this_thread = scheme_get_current_thread();
  if (!this_thread->name) {
    Scheme_Object *tn;
    tn = scheme_intern_symbol("handler");
    this_thread->name = tn;
  }
  c->handler_running = this_thread;
  this_thread->on_kill = CAST_TOK on_handler_killed;
  this_thread->kill_data = c;
  c->suspended = 0;
  c->ready = 0;

  this_thread->error_buf = &newbuf;
  if (!scheme_setjmp(newbuf)) {
    if (!TheMrEdApp->initialized)
      TheMrEdApp->RealInit();
    else {
      DoTheEvent(c);

      while(1) {
       while (MrEdEventReady(c)) {
         MrEdDoNextEvent(c, NULL, NULL, NULL);
       }

       WaitForAnEvent_OrDie(c);
      }
    }
  }

  /* We should never get here. */
#if 0
  c->ready = 1;
  c->handler_running = NULL;
  this_thread->on_kill = NULL;
  this_thread->kill_data = NULL;
#endif

  return scheme_void;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void insert_q_callback ( Q_Callback_Set cs,
Q_Callback cb 
) [static]

Definition at line 1902 of file mred.cxx.

{
  /* This can happen under Windows, for example,
     due to an on-paint queue attempt: */
  if (cb->context->killed)
    return;

  cb->next = NULL;
  cb->prev = cs->last;
  cs->last = cb;
  if (cb->prev)
    cb->prev->next = cb;
  else
    cs->first = cb;
}

Here is the caller graph for this function:

static void kill_eventspace ( Scheme_Object ec,
void  
) [static]

Definition at line 626 of file mred.cxx.

{
  MrEdContext *c;
  c = WEAKIFIED(((Context_Custodian_Hop *)ec)->context);

  if (!c)
    return; /* must not have had any frames, timers, etc. */

  {
    wxClipboardClient *clipOwner;
    clipOwner = wxTheClipboard->GetClipboardClient();
    if (clipOwner && (clipOwner->context == c))
      wxTheClipboard->SetClipboardString("", 0);
  }

  c->killed = 1;

  {
    wxChildNode *node, *next;
    for (node = c->topLevelWindowList->First(); node; node = next) {
      wxWindow *w;
      w = (wxWindow *)node->Data();
      next = node->Next();
      if (w) {
       w->ForEach(destroy_wxObject, NULL);
       if (node->IsShown())
         w->Show(FALSE);
      }
    }
  }

  {
    wxTimer *t;
    while (c->timers) {
      t = c->timers;
      t->Stop();
    }
  }

  remove_q_callbacks(c);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static MrEdContext* MakeContext ( MrEdContext c) [static]

Definition at line 708 of file mred.cxx.

{
  MrEdContextFrames *frames;
  Context_Custodian_Hop *mr_hop;
  Scheme_Object *break_cell;
  Scheme_Config *config;
  Scheme_Thread_Cell_Table *cells;

  scheme_custodian_check_available(NULL, "make-eventspace", "eventspace");

  if (!c) {
    wxChildList *tlwl;
    MrEdFinalizedContext *fc;

    c = (MrEdContext *)scheme_malloc_tagged(sizeof(MrEdContext));
    c->so.type = mred_eventspace_type;

    tlwl = new WXGC_PTRS wxChildList();
    c->topLevelWindowList = tlwl;
    fc = new WXGC_PTRS MrEdFinalizedContext;
    c->finalized = fc;
  }

  c->ready = 1;

  c->handler_running = NULL;

  c->busyState = 0;
  c->killed = 0;

  frames = new WXGC_PTRS MrEdContextFrames;
  c->finalized->frames = frames;
  frames->next = mred_frames;
  frames->prev = NULL;
  frames->list = c->topLevelWindowList;
  {
    MrEdContextFramesRef r;
    r = MAKE_FRAMES_REF(frames);
    if (mred_frames)
      FRAMES_REF(mred_frames)->prev = r;
    mred_frames = r;
  }

  c->modal_window = NULL;

  config = scheme_extend_config(scheme_current_config(), 
                            mred_eventspace_param, 
                            (Scheme_Object *)c);

  c->main_config = config;
  cells = scheme_inherit_cells(NULL);
  c->main_cells = cells;
  break_cell = scheme_current_break_cell();
  c->main_break_cell = break_cell;

#ifdef MZ_PRECISE_GC
  /* Override destructor-based finalizer: */
  GC_set_finalizer(gcOBJ_TO_PTR(c->finalized),
                 0, 3,
                 CollectingContext, NULL,
                 NULL, NULL);
#else
  scheme_register_finalizer(gcOBJ_TO_PTR(c->finalized),
                         CAST_GCP CollectingContext, NULL,
                         NULL, NULL);
#endif
  WXGC_IGNORE(c, c->finalized);

#ifdef MZ_PRECISE_GC
  mr_hop = (Context_Custodian_Hop *)GC_malloc_one_tagged(sizeof(Context_Custodian_Hop));
#else
  mr_hop = (Context_Custodian_Hop *)scheme_malloc_atomic(sizeof(Context_Custodian_Hop));
#endif
  mr_hop->so.type = mred_eventspace_hop_type;
  {
    MrEdContext *ctx;
    ctx = WEAKIFY(c);
    mr_hop->context = ctx;
  }
  c->mr_hop = mr_hop;
#ifndef MZ_PRECISE_GC
  scheme_weak_reference((void **)(void *)&mr_hop->context);
#endif

  {
    Scheme_Custodian_Reference *mr;
    mr = scheme_add_managed(NULL, (Scheme_Object *)mr_hop,
                         CAST_SCCC kill_eventspace,
                         NULL, 0);
    c->mref = mr;
  }

  return c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MrEd_add_q_callback ( char *  who,
int  argc,
Scheme_Object **  argv 
)

Definition at line 1990 of file mred.cxx.

{
  MrEdContext *c;
  Q_Callback_Set *cs;
  Q_Callback *cb;
  int hi;

  scheme_check_proc_arity(who, 0, 0, argc, argv);
  c = (MrEdContext *)wxsCheckEventspace("queue-callback");

  if (argc > 1) {
    if (argv[1] == MrEd_mid_queue_key)
      hi = 1;
    else
      hi = (SCHEME_TRUEP(argv[1]) ? 2 : 0);
  } else
    hi = 2;

  cs = q_callbacks + hi;

  cb = (Q_Callback*)scheme_malloc(sizeof(Q_Callback));
  cb->context = c;
  cb->callback = argv[0];

  insert_q_callback(cs, cb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1017 of file mred.cxx.

{
  Scheme_Thread *thread;
  thread = scheme_get_current_thread();

  if (!ctx)
    ctx = MrEdGetContext();

  return (((MrEdContext *)ctx)->handler_running == thread);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1028 of file mred.cxx.

{
#ifdef NEED_HET_PARAM
  /* see wxHiEventTrampoline for info on mred_het_key: */
  Scheme_Object *v;
  if (!scheme_get_current_thread()) 
    return 1;
  
  if (mred_het_key)
    v = scheme_extract_one_cc_mark(NULL, mred_het_key);
  else
    v = NULL;

  if (v && SCHEME_BOX_VAL(v))
    return 1;
#endif
  return 0;
}

Here is the caller graph for this function:

Definition at line 189 of file mred.cxx.

Here is the caller graph for this function:

Definition at line 191 of file mred.cxx.

Here is the caller graph for this function:

Definition at line 1006 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static int MrEdContextReady ( MrEdContext ,
MrEdContext c 
) [static]

Definition at line 1471 of file mred.cxx.

{
  return ((MrEdContext *)c)->ready;
}

Here is the caller graph for this function:

static Scheme_Object* MrEdDoNextEvent ( MrEdContext c,
wxDispatch_Check_Fun  alt,
void altdata,
Scheme_Object alt_wait 
) [static]

Definition at line 1219 of file mred.cxx.

{
  wxTimer *timer;
  GC_CAN_IGNORE MrEdEvent evt;
  int restricted = 0;

#ifdef NEED_HET_PARAM
  /* see wxHiEventTrampoline for info on mred_het_key: */
  if (mred_in_restricted_context())
    restricted = 1;
#endif

  if (alt) {
    if (alt(altdata)) {
      /* Do nothing, since alt fired. */
      return scheme_void;
    }
  }
  if (alt_wait) {
    Scheme_Object *a[2], *r;
    a[0] = scheme_make_integer(0);
    a[1] = alt_wait;
    r = scheme_sync_timeout(2, a);

    if (r) {
      /* Do nothing, since alt fired. */
      return r;
    }
  }

  if (c->nested_avail) {
    c->nested_avail = 0;
    DoTheEvent(c);
  } else if (check_q_callbacks(2, MrEdSameContext, c, 1)) {
    c->q_callback = 3;
    DoTheEvent(c);
  } else if ((timer = TimerReady(c))) {
    timer->Dequeue();
    c->timer = timer;
    DoTheEvent(c);
  } else if (check_q_callbacks(1, MrEdSameContext, c, 1)) {
    c->q_callback = 2;
    DoTheEvent(c);
  } else if (!restricted && MrEdGetNextEvent(0, 1, &evt, NULL)) {
    memcpy(&c->event, &evt, sizeof(MrEdEvent));
    DoTheEvent(c);
#ifdef wx_mac
    /* MrEdGetNextEvent might enqueue */
  } else if (check_q_callbacks(1, MrEdSameContext, c, 1)) {
    c->q_callback = 2;
    DoTheEvent(c);
#endif
  } else if (!restricted && check_q_callbacks(0, MrEdSameContext, c, 1)) {
    c->q_callback = 1;
    DoTheEvent(c);
  } else if (c != mred_main_context) {
    Scheme_Object *result = NULL;

    c->ready = 1;
    c->waiting_for_nested = 1;

    c->alternate = alt;
    c->alt_data = altdata;

    if (alt_wait) {
      Nested_Wait *nw;
      Scheme_Object *a[2], *v = NULL;

      nw = (Nested_Wait *)scheme_malloc_tagged(sizeof(Nested_Wait));
      nw->so.type = mred_nested_wait_type;
      nw->wait_on = (Scheme_Object *)c;

      a[0] = alt_wait;
      a[1] = (Scheme_Object *)nw;

      /* Running arbitrary Scheme code here. */
      BEGIN_ESCAPEABLE(reset_nested_wait, c);
      v = scheme_sync(2, a);
      END_ESCAPEABLE();

      if (!SAME_OBJ(v, a[1]))
       result = v;
    } else {
      scheme_block_until((Scheme_Ready_Fun)do_check_for_nested_event, NULL,
                      (Scheme_Object *)c, 0.0);
    }

    c->alternate = NULL;
    c->alt_data = NULL;

    if (c->waiting_for_nested) {
      /* Alternate condition fired. Clear waiting flag. */
      c->ready = 0;
      c->waiting_for_nested = 0;
      if (!result)
       result = scheme_void;
    }

    return result;
  }

  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1335 of file mred.cxx.

{
  int restricted = 0;

#ifdef NEED_HET_PARAM
  /* see wxHiEventTrampoline for info on mred_het_key: */
  if (mred_in_restricted_context())
    restricted = 1;
#endif

  return (c->nested_avail
         || TimerReady(c)
         || (!restricted && MrEdGetNextEvent(1, 1, NULL, NULL))
         || (!restricted && check_q_callbacks(2, MrEdSameContext, c, 1))
         || check_q_callbacks(1, MrEdSameContext, c, 1)
         || check_q_callbacks(0, MrEdSameContext, c, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 897 of file mred.cxx.

{
  return (Scheme_Object *)((MrEdContext *)e)->handler_running;
}

Here is the caller graph for this function:

void* MrEdForEachFrame ( ForEachFrameProc  fp,
void data 
)

Definition at line 934 of file mred.cxx.

{
  MrEdContextFrames *f;
  MrEdContextFramesRef fr = mred_frames;
  wxChildNode *node;

  while (fr) {
    f = FRAMES_REF(fr);
    node = f->list->First();

    while (node) {
      if (node->IsShown()) {
       wxObject *o;
       o = node->Data();
#ifdef wx_mac
       /* Mac: some frames really represent dialogs. Any modal frame is
          a dialog, so extract its only child. */
       if (((wxFrame *)o)->IsModal()) {
         wxChildNode *node2;
         wxChildList *cl;
         cl = ((wxFrame *)o)->GetChildren();
         node2 = cl->First();
         if (node2)
           o = node2->Data();
       }
#endif
       data = fp(o, data);
      }
      node = node->Next();
    }

    fr = f->next;
  }

  return data;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 403 of file mred.cxx.

{
  if (w) {
#if !defined(wx_xt) && !defined(wx_mac)
    if (wxSubType(w->__type, wxTYPE_FRAME)) {
#endif
      MrEdContext *c;
      c = (MrEdContext *)((wxFrame *)w)->context;
      if (c)
       return c;
#if !defined(wx_xt) && !defined(wx_mac)
    } else {
      MrEdContext *c;
      c = (MrEdContext *)((wxDialogBox *)w)->context;
      if (c)
       return c;
    }
#endif
  }

  if (mred_only_context) {
    if (only_context_just_once) {
      MrEdContext *c = mred_only_context;
      mred_only_context = NULL;
      only_context_just_once = 0;
      return c;
    } else
      return mred_only_context;
  } else
    return (MrEdContext *)scheme_get_param(scheme_current_config(), mred_eventspace_param);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 84 of file mredmac.cxx.

{
  return (int)(GetDblTime() * 16.67);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 902 of file mred.cxx.

{
  MrEdContext *c;
  Scheme_Object *l = scheme_null;
  c = MrEdGetContext();

  if (c) {
    wxChildNode *node;
    for (node = c->topLevelWindowList->First(); node; node = node->Next()) {
      wxObject *o;
      o = node->Data();
      if (node->IsShown()) {
#ifdef wx_mac
       /* Mac: some frames really represent dialogs. Any modal frame is
          a dialog, so extract its only child. */
       if (((wxFrame *)o)->IsModal()) {
         wxChildNode *node2;
         wxChildList *cl;
         cl = ((wxFrame *)o)->GetChildren();
         node2 = cl->First();
         if (node2)
           o = node2->Data();
       }
#endif
       l = scheme_make_pair(objscheme_bundle_wxObject(o), l);
      }
    }
  }

  return l;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 435 of file mred.cxx.

{
  while (1) {
    if (wxSubType(w->__type, wxTYPE_FRAME))
      return MrEdGetContext(w);
#if !defined(wx_xt) && !defined(wx_mac)
    if (wxSubType(w->__type, wxTYPE_DIALOG_BOX))
      return MrEdGetContext(w);
#endif

    w = w->GetParent();
  }
}

Here is the call graph for this function:

static void MrEdIgnoreWarnings ( char *  ,
GC_word   
) [static]

Definition at line 2951 of file mred.cxx.

{
}

Here is the caller graph for this function:

Definition at line 886 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static void MrEdOutOfMemory ( void  ) [static]

Definition at line 2896 of file mred.cxx.

{
  /* Hopefully we have enough memory for a message dialog under
     Windows and Mac OS X: */
#ifdef wx_mac
  Alert(101, NULL);
#endif
#ifdef wx_msw
  wxNoMoreCallbacks();
  MessageBox(NULL, 
             "PLT Scheme virtual machine is out of memory. Aborting.",
             "Out of Memory",
             MB_OK);
#endif
  /* For X, mzscheme already writes to stderr (and maybe syslog). */
}

Here is the caller graph for this function:

Definition at line 2175 of file mred.cxx.

{
  Scheme_Object *p;
  MrEdContext *c = (MrEdContext *)clipOwner->context;
  Q_Callback *cb;

  if (c) {
    clipOwner->context = NULL;

    p = scheme_make_closed_prim(CAST_SCP call_being_replaced, clipOwner);

    cb = (Q_Callback*)scheme_malloc(sizeof(Q_Callback));
    cb->context = c;
    cb->callback = p;

    insert_q_callback(q_callbacks + 1, cb);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MrEdQueueInEventspace ( void context,
Scheme_Object thunk 
)

Definition at line 2194 of file mred.cxx.

{
  Q_Callback *cb;

  cb = (Q_Callback*)scheme_malloc(sizeof(Q_Callback));
  cb->context = (MrEdContext *)context;
  cb->callback = thunk;

  insert_q_callback(q_callbacks + 1, cb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int MrEdSameContext ( MrEdContext c,
MrEdContext testc 
) [static]

Definition at line 1122 of file mred.cxx.

{
  return (c == testc);
}

Here is the caller graph for this function:

static void MrEdSleep ( float  secs,
void fds 
) [static]

Definition at line 1716 of file mred.cxx.

{
  double now;

#ifdef NEVER_EVER_SLEEP
  return;
#endif

  if (!(KEEP_GOING))
    return;

  now = scheme_get_inexact_milliseconds();
  {
    wxTimer *timer;

    timer = GlobalFirstTimer();

    if (timer) {
      double done = timer->expiration;
      double diff = done - now;

      diff /= 1000;
      if (diff <= 0)
       secs = (float)0.00001;
      else if (!secs || (secs > diff))
       secs = (float)diff;
    }
  }

#ifdef wx_msw
  MrEdMSWSleep(secs, fds, mzsleep);
#else
# ifdef wx_mac
  MrEdMacSleep(secs, fds, mzsleep);
# else
  mzsleep(secs, fds);
# endif
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void not_so_much_memory ( void  ) [static]

Definition at line 2926 of file mred.cxx.

Here is the caller graph for this function:

static void on_handler_killed ( Scheme_Thread p) [static]

Definition at line 1402 of file mred.cxx.

{
  MrEdContext *c = (MrEdContext *)p->kill_data;

  p->on_kill = NULL;
  p->kill_data = NULL;

  /* The thread is forever not ready: */
  c->handler_running = NULL;
  c->ready = 0;
  c->waiting_for_nested = 0;
  c->nested_avail = 0;
  c->q_callback = 0;
  c->timer = NULL;
  c->alternate = NULL;
  c->alt_data = NULL;
  c->ready_to_go = 0;
}

Here is the caller graph for this function:

static void on_main_killed ( Scheme_Thread p) [static]

Definition at line 3186 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static void remove_q_callback ( Q_Callback_Set cs,
Q_Callback cb 
) [static]

Definition at line 1918 of file mred.cxx.

{
  if (cb->prev)
    cb->prev->next = cb->next;
  else
    cs->first = cb->next;
  if (cb->next)
    cb->next->prev = cb->prev;
  else
    cs->last = cb->prev;

  cb->next = NULL;
  cb->prev = NULL;
}

Here is the caller graph for this function:

static void remove_q_callbacks ( MrEdContext c) [static]

Definition at line 1972 of file mred.cxx.

{
  Q_Callback_Set *cs;
  Q_Callback *cb, *next;
  int i;

  for (i = 0; i < 3; i++) {
    cs = q_callbacks + i;
    for (cb = cs->first; cb; cb = next) {
      next = cb->next;
      if (cb->context == c)
       remove_q_callback(cs, cb);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reset_nested_wait ( MrEdContext c) [static]

Definition at line 1211 of file mred.cxx.

{
  c->ready = 0;
  c->waiting_for_nested = 0;
  c->alternate = NULL;
  c->alt_data = NULL;
}

Here is the caller graph for this function:

static Scheme_Env* setup_basic_env ( ) [static]

Definition at line 2961 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static wxTimer* TimerReady ( MrEdContext c) [static]

Definition at line 1051 of file mred.cxx.

{
  wxTimer *timer;

  if (c) {
    timer = c->timers;
  } else {
    timer = GlobalFirstTimer();
  }

  if (timer) {
    double now;
    double goal = timer->expiration;

    now = scheme_get_inexact_milliseconds();

    return ((now >= goal)
           ? timer
           : (wxTimer *)NULL);
  } else
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int try_dispatch ( Scheme_Object do_it) [static]

Definition at line 1523 of file mred.cxx.

{
  MrEdContext *c;
  GC_CAN_IGNORE MrEdEvent e;
  wxTimer *timer;
  int got_one;

  if (try_q_callback(do_it, 2))
    return 1;

  timer = TimerReady(NULL);

  if (timer) {
    if (!do_it)
      return 1;
    if (SCHEME_FALSEP(do_it))
      scheme_set_current_thread_ran_some();

    c = (MrEdContext *)timer->context;

    timer->Dequeue();

    if (c == mred_main_context)
      timer->Notify();
    else {
      c->timer = timer;
      event_found(c);
    }

    return 1;
  }

  if (try_q_callback(do_it, 1))
    return 1;

  ChainContextsList();

  got_one = MrEdGetNextEvent(!do_it, 0, &e, &c);

  UnchainContextsList();

#ifdef wx_mac
  /* MrEdGetNextEvent might enqueue */
  if (try_q_callback(do_it, 1))
    return 1;
#endif

  if (got_one) {
    if (!do_it)
      return 1;

    if (SCHEME_FALSEP(do_it))
      scheme_set_current_thread_ran_some();

    if (c) {
      memcpy(&c->event, &e, sizeof(MrEdEvent));
      event_found(c);
    } else {
      /* Event with unknown context: */
      MrEdDispatchEvent(&e);
    }

    return 1;
  }

  if (try_q_callback(do_it, 0))
    return 1;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int try_q_callback ( Scheme_Object do_it,
int  hi 
) [static]

Definition at line 1499 of file mred.cxx.

{
  MrEdContext *c;

  if ((c = check_q_callbacks(hi, MrEdContextReady, NULL, 1))) {
    if (!do_it)
      return 1;

    if (SCHEME_FALSEP(do_it))
      scheme_set_current_thread_ran_some();

    if (c == mred_main_context)
      check_q_callbacks(hi, MrEdSameContext, c, 0);
    else {
      c->q_callback = 1 + hi;
      event_found(c);
    }

    return 1;
  }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void UnchainContextsList ( ) [static]

Definition at line 832 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static void WaitForAnEvent_OrDie ( MrEdContext c) [static]

Definition at line 1365 of file mred.cxx.

{
  c->ready = 1;
  c->waiting_for_nested = 1;
  c->alternate = NULL;
  c->alt_data = NULL;

  /* Suspend the thread. If another event is found for the eventspace, the
     thread will be resumed. */
  c->suspended = 1;
  while (1) {
    scheme_weak_suspend_thread(c->handler_running); /* suspend self */

    if (c->waiting_for_nested) {
      /* we were resumed for a break signal, or some such: */
      c->suspended = 0;
      c->ready = 0;
      c->waiting_for_nested = 0;

      scheme_thread_block(0);
      scheme_set_current_thread_ran_some();

      /* Go back to sleep: */
      c->ready = 1;
      c->waiting_for_nested = 1;
      c->suspended = 1;
    } else
      break;
  }

  /* An event has been found. Do it. */
  c->nested_avail = 0;
  DoTheEvent(c);

  /* Return to loop and look for more events... */
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void wakeup_on_dispatch ( Scheme_Object ,
void fds 
) [static]

Definition at line 1594 of file mred.cxx.

{
#ifdef wx_x
  Display *d = XtDisplay(mred_main_context->finalized->toplevel);
  int fd;

  fd = ConnectionNumber(d);

  MZ_FD_SET(fd, (fd_set *)fds);
#endif
}

Here is the caller graph for this function:

Definition at line 1704 of file mred.cxx.

Here is the caller graph for this function:

void wxBlockUntilTimeout ( wxDispatch_Check_Fun  f,
void data,
float  timeout 
)

Definition at line 1709 of file mred.cxx.

Here is the caller graph for this function:

Definition at line 3323 of file mred.cxx.

{
  if (!TheMrEdApp) {
#ifdef wx_mac
    wxmac_reg_globs();
#endif
#ifdef wx_msw
  {
    HANDLE h;
    h = GetStdHandle(STD_OUTPUT_HANDLE);
    if (h && (h != INVALID_HANDLE_VALUE)
        && (GetFileType(h) != FILE_TYPE_UNKNOWN)) {
      wx_in_terminal = 1;
    }
  }
#endif

    wxREGGLOB(orig_ps_setup);
    wxREGGLOB(q_callbacks);

    wxREGGLOB(TheMrEdApp);
    TheMrEdApp = new WXGC_PTRS MrEdApp;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1699 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1664 of file mred.cxx.

{
  MrEdContext *c;
  Scheme_Object *result = scheme_void;
  Scheme_Thread *thread;

  c = MrEdGetContext();
#ifdef wx_mac
  wxMouseEventHandled();
#endif

  thread = scheme_get_current_thread();
  if (c->ready_to_go
      || (c->handler_running != thread)) {
    /* This is not the handler thread or an event still hasn't been
       dispatched. Wait. */
    if (w) {
      Scheme_Object *a[1];
      a[0] = w;
      result = scheme_sync(1, a);
    } else {
      scheme_block_until((Scheme_Ready_Fun)f, NULL, (Scheme_Object *)data, 0.0);
    }
  } else {
    /* This is the main thread. Handle events */
    do {
      result = MrEdDoNextEvent(c, f, data, w);
      if (result)
       break;
    } while (1);
  }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void wxDo ( Scheme_Object proc,
int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 3631 of file mred.cxx.

{
  mz_jmp_buf * volatile save, newbuf;
  volatile int block_descriptor;
  Scheme_Thread *thread;
  thread = scheme_get_current_thread();

  if (!proc) {
    /* Oops --- too early. */
    return;
  }

  /* wxDo might be called when MrEd is sleeping (i.e.,
     blocked on WNE in OS X). Since we're hijacking the
     thread, save an restore block information. */
  block_descriptor = thread->block_descriptor;
  thread->block_descriptor = 0;

  scheme_start_atomic();

  save = thread->error_buf;
  thread->error_buf = &newbuf;

  if (scheme_setjmp(newbuf)) {
    scheme_clear_escape();
  } else {
    scheme_apply(proc, argc, argv);
  }

  thread = scheme_get_current_thread();
  thread->error_buf = save;
  thread->block_descriptor = block_descriptor;

  scheme_end_atomic_no_swap();
}

Here is the caller graph for this function:

Definition at line 1613 of file mred.cxx.

{
  /* When we get here, we are in the main dispatcher thread */
  if (!TheMrEdApp->initialized) {
    MrEdContext *c;

    /* Create the user's main thread: */

    c = (MrEdContext *)MrEdMakeEventspace();

    wxREGGLOB(user_main_context);
    user_main_context = c;

    {
      Scheme_Object *cp;
      cp = scheme_make_closed_prim(CAST_SCP handle_events, c);
      wxREGGLOB(user_main_thread);
      user_main_thread = (Scheme_Thread *)scheme_thread_w_details(cp, 
                                                          c->main_config,
                                                          c->main_cells,
                                                          c->main_break_cell,
                                                          NULL, 0);
      scheme_set_break_main_target(user_main_thread);
      cp = scheme_intern_symbol("mred");
      user_main_thread->name = cp;
    }

    /* Block until the user's main thread is initialized: */
    scheme_block_until(CAST_BLKCHK check_initialized, NULL, NULL, 0.0);
  }

  if (!try_dispatch(scheme_true)) {
    do {
      Scheme_Thread *thread;
      thread = scheme_get_current_thread();
      thread->block_descriptor = -1;
      thread->blocker = NULL;
      thread->block_check = CAST_BLKCHK try_dispatch;
      thread->block_needs_wakeup = CAST_WU wakeup_on_dispatch;

      scheme_thread_block(0);

      thread = scheme_get_current_thread();
      thread->block_descriptor = 0;
      /* Sets ran_some if it succeeds: */
      if (try_dispatch(scheme_false))
       break;
    } while (KEEP_GOING);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2956 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1323 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void wxDrop_Runtime ( char **  argv,
int  argc 
)

Definition at line 3667 of file mred.cxx.

{
  int i;

  for (i = 0; i < argc; i++) {
    Scheme_Object *p[1];
#ifdef wx_xt
    p[0] = scheme_char_string_to_path(scheme_make_utf8_string(argv[i]));
#else
    p[0] = scheme_make_path(argv[i]);
#endif
    wxDo(wxs_app_file_proc, 1, p);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1353 of file mred.cxx.

{
  MrEdContext *c;
  Scheme_Thread *thread;
  c = MrEdGetContext();
  thread = scheme_get_current_thread();

  return (!c->ready_to_go
         && (c->handler_running == thread)
         && MrEdEventReady(c));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3352 of file mred.cxx.

{
#ifdef wx_x
  Display *d;

  d = XtDisplay(wxAPP_TOPLEVEL);

  XFlush(d);
  XSync(d, FALSE);
  XFlush(d);
  XSync(d, FALSE);
#endif
#ifdef wx_mac
  wxFlushMacDisplay();
#endif
}

Here is the caller graph for this function:

Definition at line 520 of file mred.cxx.

{
  MrEdContext *c;
  c = MrEdGetContext();

  return c->busyState;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 449 of file mred.cxx.

{
  if (!TheMrEdApp)
    return NULL;
  else
    return (void *)MrEdGetContext();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 465 of file mred.cxx.

{
  MrEdContext *c;
  c = MrEdGetContext(w);

  return c->modal_window;
}

Here is the call graph for this function:

wxPrintSetupData* wxGetThePrintSetupData ( )

Definition at line 592 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 457 of file mred.cxx.

{
  MrEdContext *c;
  c = MrEdGetContext(w);

  return c->topLevelWindowList;
}

Here is the call graph for this function:

Definition at line 560 of file mred.cxx.

Here is the call graph for this function:

Definition at line 565 of file mred.cxx.

{
  return o == (Scheme_Object *)user_main_context;
}

Here is the caller graph for this function:

Definition at line 2931 of file mred.cxx.

Here is the call graph for this function:

void wxmeError ( const char *  e)

Definition at line 2575 of file mred.cxx.

{
  scheme_signal_error("%s", e);
}

Here is the caller graph for this function:

Definition at line 691 of file mredmac.cxx.

Here is the caller graph for this function:

Definition at line 539 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2913 of file mred.cxx.

void wxPopModalWindow ( wxObject w,
wxWindow win 
)

Definition at line 496 of file mred.cxx.

{
  MrEdContext *c;
  MrEd_Saved_Modal *save, *prev;
  c = MrEdGetContext(w);

  if (c->modal_window == win)
    c->modal_window = NULL;

  prev = NULL;
  for (save = c->modal_stack; save; save = save->next) {
    if ((save->win == win) || !c->modal_window) {
      if (prev)
       prev->next = save->next;
      else
       c->modal_stack = save->next;

      if (save->win != win)
       c->modal_window = save->win;
    } else
      prev = save;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxPushModalWindow ( wxObject w,
wxWindow win 
)

Definition at line 479 of file mred.cxx.

{
  MrEdContext *c;
  c = MrEdGetContext(w);

  if (c->modal_window) {
    MrEd_Saved_Modal *save;
    save = new WXGC_PTRS MrEd_Saved_Modal;

    save->next = c->modal_stack;
    save->win = c->modal_window;
    c->modal_stack = save;
  }

  c->modal_window = win;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* wxsCheckEventspace ( char *  who)

Definition at line 578 of file mred.cxx.

{
  MrEdContext *c;
  c = (MrEdContext *)wxGetContextForFrame();

  if (c->killed)
    scheme_signal_error("%s: the current eventspace has been shutdown", who);

  return (void *)c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxSetBusyState ( int  state)

Definition at line 528 of file mred.cxx.

{
  MrEdContext *c;
  c = MrEdGetContext();

  c->busyState = state;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxSetThePrintSetupData ( wxPrintSetupData *  d)

Definition at line 603 of file mred.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 570 of file mred.cxx.

{
  MrEdContext *c;
  c = (MrEdContext *)cx;

  return c->killed;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 251 of file mred.cxx.

int doubleClickThreshold = -1 [static]

Definition at line 537 of file mred.cxx.

int exit_val = 0 [static]

Definition at line 226 of file mred.cxx.

Definition at line 2893 of file mred.cxx.

Definition at line 205 of file mred.cxx.

OOM_ptr mr_save_oom [static]

Definition at line 2923 of file mred.cxx.

Definition at line 239 of file mred.cxx.

Definition at line 247 of file mred.cxx.

Definition at line 250 of file mred.cxx.

Definition at line 246 of file mred.cxx.

Definition at line 248 of file mred.cxx.

Definition at line 188 of file mred.cxx.

Definition at line 244 of file mred.cxx.

Definition at line 240 of file mred.cxx.

Definition at line 1988 of file mred.cxx.

Definition at line 249 of file mred.cxx.

Definition at line 241 of file mred.cxx.

Definition at line 252 of file mred.cxx.

Definition at line 110 of file mred.cxx.

Definition at line 190 of file mred.cxx.

Definition at line 1714 of file mred.cxx.

Definition at line 242 of file mred.cxx.

mz_jmp_buf oom_buf [static]

Definition at line 2924 of file mred.cxx.

wxPrintSetupData* orig_ps_setup [static]

Definition at line 590 of file mred.cxx.

int ps_ready = 0 [static]

Definition at line 589 of file mred.cxx.

Definition at line 1900 of file mred.cxx.

Definition at line 224 of file mred.cxx.

Definition at line 245 of file mred.cxx.

Definition at line 243 of file mred.cxx.

Definition at line 116 of file mred.cxx.