Back to index

plt-scheme  4.2.1
Classes | Defines | Functions | Variables
mrmain.cxx File Reference
#include "wx.h"
#include "wxs/wxscheme.h"
#include "wxs/wxsmred.h"
#include "mred.h"
#include "../mzscheme/cmdline.inc"

Go to the source code of this file.

Classes

struct  Main_Args

Defines

#define Uses_XtIntrinsic
#define Uses_XtIntrinsicP
#define Uses_XLib
#define Uses_wxApp
#define IS_MRMAIN
#define INIT_FILENAME   "PREFERENCES:mredrc.ss"
#define GET_INIT_FILENAME   get_init_filename
#define PRINTF   printf
#define PROGRAM   "MrEd"
#define PROGRAM_LC   "mred"
#define INITIAL_BIN_TYPE   "ri"
#define SETUP_GETENV_HACK   /* empty */
#define TAKEDOWN_GETENV_HACK   /* empty */
#define CMDLINE_STDIO_FLAG
#define YIELD_BEFORE_EXIT
#define INITIAL_NAMESPACE_MODULE   "scheme/gui/init"

Functions

static void yield_indefinitely ()
static char * get_init_filename (Scheme_Env *env)
static void do_graph_repl (Scheme_Env *env)
static int finish_cmd_line_run (void)
static int do_main_loop (FinishArgs *fa)
static void run_from_cmd_line (int argc, char **argv, Scheme_Env *(*mk_basic_env)(void))
static int main_after_stack (int argc, char *argv[])
static int call_main_after_stack (void *data)
int main (int argc, char *argv[])

Variables

static FinishArgs * xfa

Class Documentation

struct Main_Args

Definition at line 283 of file mrmain.cxx.

Class Members
int argc
MAIN_char ** argv
char ** argv

Define Documentation

Definition at line 142 of file mrmain.cxx.

Definition at line 113 of file mrmain.cxx.

#define INIT_FILENAME   "PREFERENCES:mredrc.ss"

Definition at line 109 of file mrmain.cxx.

#define INITIAL_BIN_TYPE   "ri"

Definition at line 123 of file mrmain.cxx.

#define INITIAL_NAMESPACE_MODULE   "scheme/gui/init"

Definition at line 144 of file mrmain.cxx.

#define IS_MRMAIN

Definition at line 29 of file mrmain.cxx.

#define PRINTF   printf

Definition at line 119 of file mrmain.cxx.

#define PROGRAM   "MrEd"

Definition at line 121 of file mrmain.cxx.

#define PROGRAM_LC   "mred"

Definition at line 122 of file mrmain.cxx.

#define SETUP_GETENV_HACK   /* empty */

Definition at line 138 of file mrmain.cxx.

#define TAKEDOWN_GETENV_HACK   /* empty */

Definition at line 139 of file mrmain.cxx.

#define Uses_wxApp

Definition at line 27 of file mrmain.cxx.

#define Uses_XLib

Definition at line 26 of file mrmain.cxx.

Definition at line 24 of file mrmain.cxx.

Definition at line 25 of file mrmain.cxx.

Definition at line 143 of file mrmain.cxx.


Function Documentation

static int call_main_after_stack ( void data) [static]

Definition at line 288 of file mrmain.cxx.

{
  Main_Args *ma = (Main_Args *)data;
  return main_after_stack(ma->argc, ma->argv);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_graph_repl ( Scheme_Env env) [static]

Definition at line 163 of file mrmain.cxx.

{
  mz_jmp_buf * volatile save, newbuf;
  Scheme_Thread * volatile p;
  Scheme_Object *a[2], *v;

  p = scheme_get_current_thread();
  save = p->error_buf;
  p->error_buf = &newbuf;

  if (!scheme_setjmp(newbuf)) {
    if (xfa->a->alternate_rep) {
      a[0] = scheme_intern_symbol("mred/mred");
      a[1] = scheme_intern_symbol("textual-read-eval-print-loop");
    } else {
      a[0] = scheme_intern_symbol("mred/mred");
      a[1] = scheme_intern_symbol("graphical-read-eval-print-loop");
    }
    v = scheme_dynamic_require(2, a);
    scheme_apply(v, 0, NULL);
  }

  p->error_buf = save;

#ifdef MZ_PRECISE_GC
  env = NULL; /* makes xform think that env is live, so we get a __gc_var_stack__ */
#endif
}

Here is the caller graph for this function:

static int do_main_loop ( FinishArgs *  fa) [static]

Definition at line 197 of file mrmain.cxx.

{
  wxREGGLOB(xfa);
  xfa = fa;

#ifdef wx_mac
  if (!fa->a->no_front) {
    ProcessSerialNumber psn;
    GetCurrentProcess(&psn);    
    SetFrontProcess(&psn); /* kCurrentProcess doesn't work */
  }
#endif

 {
   mz_jmp_buf * volatile save, newbuf;
   Scheme_Thread * volatile p;

   p = scheme_get_current_thread();
   save = p->error_buf;
   p->error_buf = &newbuf;
   if (!scheme_setjmp(newbuf))
     wxDoMainLoop();
   p->error_buf = save;
 }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int finish_cmd_line_run ( void  ) [static]

Definition at line 192 of file mrmain.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

static char* get_init_filename ( Scheme_Env env) [static]

Definition at line 83 of file mrmain.cxx.

{
  Scheme_Object *type;
  Scheme_Object *path;

  type = scheme_intern_symbol("init-file");
  
  path = wxSchemeFindDirectory(1, &type);

  return SCHEME_BYTE_STR_VAL(path);
}

Here is the call graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 294 of file mrmain.cxx.

{
  Main_Args ma;
  ma.argc = argc;
  ma.argv = argv;
  return scheme_main_stack_setup(1, call_main_after_stack, &ma);
}

Here is the call graph for this function:

static int main_after_stack ( int  argc,
char *  argv[] 
) [static]

Definition at line 233 of file mrmain.cxx.

{
  int rval;

#ifdef wx_x
# if INTERRUPT_CHECK_ON
  signal(SIGINT, interrupt);
# endif
#endif

#ifdef SGC_STD_DEBUGGING
  fprintf(stderr, "Starting MrEd with sgc for debugging\n");
#endif

#ifdef wx_mac
  wxMacDisableMods = controlKey;
# ifndef OS_X
  scheme_creator_id = 'mReD';
  wxMediaCreatorId = 'mReD';
# endif
#endif

#ifdef wx_mac
  /* initialize Mac stuff */
  wx_original_argv_zero = argv[0];
  wxDrop_GetArgs(&argc, &argv, &wx_in_terminal);
#endif

  mred_set_run_from_cmd_line(run_from_cmd_line);
  mred_set_finish_cmd_line_run(finish_cmd_line_run);

  wxCreateApp();
  
  rval = wxEntry(argc, argv);

#ifdef wx_msw
  mred_clean_up_gdi_objects();
#endif 
  
  return rval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void run_from_cmd_line ( int  argc,
char **  argv,
Scheme_Env *(*)(void mk_basic_env 
) [static]

Definition at line 225 of file mrmain.cxx.

{
#ifdef NEED_MRED_CONSOLE_PRINTF
  mred_console_printf = scheme_get_console_printf();
#endif
  run_from_cmd_line(argc, argv, mk_basic_env, do_main_loop);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void yield_indefinitely ( ) [static]

Definition at line 59 of file mrmain.cxx.

{
#ifdef MZ_PRECISE_GC
  void *dummy;
#endif
  mz_jmp_buf * volatile save, newbuf;
  Scheme_Thread * volatile p;

  p = scheme_get_current_thread();
  save = p->error_buf;
  p->error_buf = &newbuf;

  if (!scheme_setjmp(newbuf)) {
    mred_wait_eventspace();
  }

  p->error_buf = save;

#ifdef MZ_PRECISE_GC
  dummy = NULL; /* makes xform think that dummy is live, so we get a __gc_var_stack__ */
#endif
}

Here is the call graph for this function:


Variable Documentation

FinishArgs* xfa [static]

Definition at line 161 of file mrmain.cxx.