Back to index

plt-scheme  4.2.1
Classes | Defines | Functions
main.c File Reference
#include "scheme.h"
#include <signal.h>
#include "cmdline.inc"
#include "oskglue.inc"

Go to the source code of this file.

Classes

struct  Main_Args

Defines

#define INIT_FILENAME   "PREFERENCES:mzschemerc.ss"
#define GET_INIT_FILENAME   get_init_filename
#define PRINTF   printf
#define PROGRAM   "MzScheme"
#define PROGRAM_LC   "mzscheme"
#define INITIAL_BIN_TYPE   "zi"
#define BANNER   scheme_banner()
#define MZSCHEME_CMD_LINE
#define INITIAL_NAMESPACE_MODULE   "scheme/init"
#define MAIN   main
#define MAIN_char   char
#define MAIN_argv   argv

Functions

static char * get_init_filename (Scheme_Env *env)
static void user_break_hit (int ignore)
static void do_scheme_rep (Scheme_Env *)
static int cont_run (FinishArgs *f)
static int main_after_dlls (int argc, MAIN_char **MAIN_argv)
static int main_after_stack (void *data)
int MAIN (int argc, MAIN_char **MAIN_argv)

Class Documentation

struct Main_Args

Definition at line 283 of file mrmain.cxx.

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

Define Documentation

#define BANNER   scheme_banner()

Definition at line 148 of file main.c.

Definition at line 143 of file main.c.

#define INIT_FILENAME   "PREFERENCES:mzschemerc.ss"

Definition at line 140 of file main.c.

#define INITIAL_BIN_TYPE   "zi"

Definition at line 147 of file main.c.

#define INITIAL_NAMESPACE_MODULE   "scheme/init"

Definition at line 150 of file main.c.

#define MAIN   main

Definition at line 206 of file main.c.

#define MAIN_argv   argv

Definition at line 208 of file main.c.

#define MAIN_char   char

Definition at line 207 of file main.c.

Definition at line 149 of file main.c.

#define PRINTF   printf

Definition at line 144 of file main.c.

#define PROGRAM   "MzScheme"

Definition at line 145 of file main.c.

#define PROGRAM_LC   "mzscheme"

Definition at line 146 of file main.c.


Function Documentation

static int cont_run ( FinishArgs *  f) [static]

Definition at line 310 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_scheme_rep ( Scheme_Env env) [static]

Definition at line 318 of file main.c.

{
  /* enter read-eval-print loop */
  {
    Scheme_Object *rep, *a[2];

    a[0] = scheme_intern_symbol("scheme/base");
    a[1] = scheme_intern_symbol("read-eval-print-loop");
    rep = scheme_dynamic_require(2, a);
    
    if (rep) {
      scheme_apply(rep, 0, NULL);
      printf("\n");
    }
  }
}

Here is the caller graph for this function:

static char* get_init_filename ( Scheme_Env env) [static]

Definition at line 99 of file main.c.

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

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

  if (!scheme_setjmp(newbuf)) {
    f = scheme_builtin_value("find-system-path");
    if (f) {
      Scheme_Object *a[1];

      a[0] = scheme_intern_symbol("init-file");

      f = _scheme_apply(f, 1, a);

      if (SCHEME_PATHP(f)) {
       p->error_buf = save;
       return SCHEME_PATH_VAL(f);
      }
    }
  }
  p->error_buf = save;

  return NULL;
}
int MAIN ( int  argc,
MAIN_char **  MAIN_argv 
)

Definition at line 221 of file main.c.

{
#ifdef DOS_FILE_SYSTEM
  /* Order matters: load dependencies first */
# ifndef MZ_PRECISE_GC
  load_delayed_dll(NULL, "libmzgcxxxxxxx.dll");
# endif
  load_delayed_dll(NULL, "libmzsch" DLL_3M_SUFFIX "xxxxxxx.dll");
  record_dll_path();
#endif

  return main_after_dlls(argc, MAIN_argv);
}

Here is the call graph for this function:

static int main_after_dlls ( int  argc,
MAIN_char **  MAIN_argv 
) [static]

Definition at line 247 of file main.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

static int main_after_stack ( void data) [static]

Definition at line 258 of file main.c.

{
  int rval;
  int argc;
  MAIN_char **MAIN_argv;
#ifdef WINDOWS_UNICODE_MAIN
  char **argv;
#endif

  argc = ((Main_Args *)data)->argc;
  MAIN_argv = ((Main_Args *)data)->argv;

#if defined(OSKIT) && !defined(OSKIT_TEST) && !KNIT
  oskit_prepare(&argc, &argv);
#endif

#ifdef WINDOWS_UNICODE_MAIN
 {
   char *a;
   int i, j, l;
   argv = (char **)malloc(sizeof(char*)*argc);
   for (i = 0; i < argc; i++) {
     for (j = 0; wargv[i][j]; j++) {
     }
     l = scheme_utf8_encode((unsigned int*)wargv[i], 0, j, 
                         NULL, 0,
                         1 /* UTF-16 */);
     a = malloc(l + 1);
     scheme_utf8_encode((unsigned int *)wargv[i], 0, j, 
                     (unsigned char *)a, 0,
                     1 /* UTF-16 */);
        a[l] = 0;
     argv[i] = a;
   }
 }
#endif

#ifndef NO_USER_BREAK_HANDLER
  MZ_SIGSET(SIGINT, user_break_hit);
#endif

  rval = run_from_cmd_line(argc, argv, scheme_basic_env, cont_run);

  scheme_immediate_exit(rval);
  
  /* shouldn't get here */
  return rval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void user_break_hit ( int  ignore) [static]

Definition at line 170 of file main.c.

{
  scheme_break_main_thread();
  scheme_signal_received();

#  ifdef SIGSET_NEEDS_REINSTALL
  MZ_SIGSET(SIGINT, user_break_hit);
#  endif
#  ifdef MZ_PRECISE_GC
#   ifndef GC_STACK_CALLEE_RESTORE
  /* Restore variable stack. */
  GC_variable_stack = (void **)__gc_var_stack__[0];
#   endif
#  endif
}

Here is the caller graph for this function: