Back to index

plt-scheme  4.2.1
cmdline.inc
Go to the documentation of this file.
00001 
00002 /***************************************************************/
00003 /* This command-line parser is used by both MzScheme and MrEd. */
00004 /***************************************************************/
00005 
00006 #define SDESC "Set! works on undefined identifiers"
00007 
00008 char *cmdline_exe_hack = "[Replace me for EXE hack                                       ]";
00009 
00010 #ifdef MZ_PRECISE_GC
00011 # define GC_PRECISION_TYPE "3"
00012 #else
00013 # define GC_PRECISION_TYPE "c"
00014 #endif
00015 char *binary_type_hack = "bINARy tYPe:" INITIAL_BIN_TYPE GC_PRECISION_TYPE;
00016 /* The format of bINARy tYPe is e?[zr]i[3c].
00017    e indicates a starter executable
00018    z/r indicates MzScheme or MrEd
00019    i indicates ???
00020    3/c indicates 3m or CGC */
00021 
00022 #ifndef INITIAL_COLLECTS_DIRECTORY
00023 # ifdef DOS_FILE_SYSTEM
00024 #  define INITIAL_COLLECTS_DIRECTORY "collects"
00025 # else
00026 #  define INITIAL_COLLECTS_DIRECTORY "../collects"
00027 # endif
00028 #endif
00029 
00030 static char *_coldir = "coLLECTs dIRECTORy:" /* <- this tag stays, so we can find it again */
00031                        INITIAL_COLLECTS_DIRECTORY 
00032                        "\0\0" /* <- 1st nul terminates path, 2nd terminates path list */
00033                        /* Pad with at least 1024 bytes: */
00034                        "****************************************************************"
00035                        "****************************************************************"
00036                        "****************************************************************"
00037                        "****************************************************************"
00038                        "****************************************************************"
00039                        "****************************************************************"
00040                        "****************************************************************"
00041                        "****************************************************************"
00042                        "****************************************************************"
00043                        "****************************************************************"
00044                        "****************************************************************"
00045                        "****************************************************************"
00046                        "****************************************************************"
00047                        "****************************************************************"
00048                        "****************************************************************"
00049                        "****************************************************************";
00050 static int _coldir_offset = 19; /* Skip permanent tag */
00051 
00052 #ifndef MZ_PRECISE_GC
00053 # define XFORM_OK_PLUS +
00054 #endif
00055 
00056 #ifdef DOS_FILE_SYSTEM
00057 # include <Windows.h>
00058 
00059 #define DLL_RELATIVE_PATH L"lib"
00060 #include "delayed.inc"
00061 
00062 extern 
00063 # ifdef __cplusplus
00064 "C"
00065 # endif
00066 __declspec(dllexport) void scheme_set_dll_path(wchar_t *s);
00067 
00068 static void record_dll_path(void)
00069 {
00070   if (_dlldir[_dlldir_offset] != '<') {
00071     scheme_set_dll_path(_dlldir + _dlldir_offset);
00072   }
00073 }
00074 
00075 # ifdef MZ_PRECISE_GC
00076 END_XFORM_SKIP;
00077 # endif
00078 #endif
00079 
00080 #ifndef DONT_PARSE_COMMAND_LINE
00081 static int is_number_arg(const char *s)
00082 {
00083   while (*s) {
00084     if (*s < '0' || *s > '9') {
00085       if (*s == '.') {
00086        s++;
00087        while (*s) {
00088          if (*s < '0' || *s > '9')
00089            return 0;
00090          else
00091            s++;
00092        }
00093        return 1;
00094       } else
00095        return 0;
00096     } else
00097       s++;
00098   }
00099 
00100   return 1;
00101 }
00102 
00103 static char *make_embedded_load(const char *start, const char *end)
00104 {
00105   char *s;
00106   int slen, elen;
00107 
00108   slen = strlen(start);
00109   elen = strlen(end);
00110 
00111   s = (char *)malloc(slen + elen + 2);
00112   memcpy(s, start, slen + 1);
00113   memcpy(s + slen + 1, end, elen + 1);
00114 
00115   return s;
00116 }
00117 #endif
00118 
00119 enum {
00120   mzcmd_EVAL            = 0,
00121   mzcmd_LOAD            = 1,
00122   mzcmd_MAIN            = 2,
00123   mzcmd_REQUIRE_FILE    = 3,
00124   mzcmd_REQUIRE_LIB     = 4,
00125   mzcmd_REQUIRE_PLANET  = 5,
00126   mzcmd_EMBEDDED        = 6,
00127 };
00128 
00129 /* To avoid having to create a specific mark procedure for
00130    prcise GC, split argument information into purely atomic
00131    and purely non-atomic records. */
00132 
00133 typedef struct {
00134   int init_ns;
00135 #ifndef DONT_PARSE_COMMAND_LINE
00136   int num_enl;
00137 #endif  
00138 #ifndef DONT_LOAD_INIT_FILE
00139   int no_init_file;
00140 #endif
00141 #ifndef DONT_RUN_REP
00142   int use_repl;
00143   int script_mode;
00144 #endif
00145 #ifdef YIELD_BEFORE_EXIT
00146   int add_yield;
00147 #endif
00148 #ifdef CMDLINE_STDIO_FLAG
00149   int alternate_rep;
00150   int no_front;
00151 #endif
00152 } FinishArgsAtoms;
00153 
00154 typedef struct {
00155   FinishArgsAtoms *a;
00156 #ifndef DONT_PARSE_COMMAND_LINE
00157   char **evals_and_loads;
00158   int *eval_kind;
00159   Scheme_Object *main_args;
00160 #endif  
00161   Scheme_Env *global_env;
00162   char *init_lib;
00163 } FinishArgs;
00164 
00165 typedef void (*Repl_Proc)(Scheme_Env *);
00166 
00167 static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl)
00168 {
00169   volatile int exit_val = 0;
00170 
00171   if (fa->a->init_ns) {
00172     Scheme_Object *nsreq, *a[1];
00173     Scheme_Thread * volatile p;
00174     mz_jmp_buf * volatile save, newbuf;
00175 
00176     nsreq = scheme_builtin_value("namespace-require");
00177     a[0] = scheme_make_pair(scheme_intern_symbol("lib"),
00178                             scheme_make_pair(scheme_make_utf8_string(fa->init_lib),
00179                                              scheme_make_null()));
00180 
00181     p = scheme_get_current_thread();
00182     save = p->error_buf;
00183     p->error_buf = &newbuf;
00184     if (!scheme_setjmp(newbuf))
00185       scheme_apply(nsreq, 1, a);
00186     else {
00187       exit_val = 1;
00188     }        
00189     p->error_buf = save;
00190   }
00191 
00192 #ifndef DONT_PARSE_COMMAND_LINE
00193   {
00194     volatile int i;
00195     mz_jmp_buf * volatile save, newbuf;
00196 
00197     for (i = 0; i < fa->a->num_enl; i++) {
00198       if (fa->eval_kind[i] == mzcmd_LOAD) {
00199        if (!scheme_load(fa->evals_and_loads[i])) {
00200          exit_val = 1;
00201          break;
00202        }
00203       } else if ((fa->eval_kind[i] == mzcmd_EVAL)
00204                  || (fa->eval_kind[i] == mzcmd_REQUIRE_FILE)
00205                  || (fa->eval_kind[i] == mzcmd_REQUIRE_LIB)
00206                  || (fa->eval_kind[i] == mzcmd_REQUIRE_PLANET)
00207                  || (fa->eval_kind[i] == mzcmd_EMBEDDED)) {
00208        Scheme_Thread * volatile p;
00209        p = scheme_get_current_thread();
00210        save = p->error_buf;
00211        p->error_buf = &newbuf;
00212         
00213         if (!scheme_setjmp(newbuf)) {
00214           if (fa->eval_kind[i] == mzcmd_EVAL) {
00215             scheme_eval_string_all_with_prompt(fa->evals_and_loads[i], fa->global_env, 2);
00216           } else if (fa->eval_kind[i] == mzcmd_EMBEDDED) {
00217             Scheme_Object *s, *e, *a[3], *eload;
00218             eload = scheme_builtin_value("embedded-load");
00219             s = scheme_make_utf8_string(fa->evals_and_loads[i]);
00220             e = scheme_make_utf8_string(fa->evals_and_loads[i] + strlen(fa->evals_and_loads[i]) + 1);
00221             a[0] = s;
00222             a[1] = e;
00223             a[2] = scheme_make_false();
00224             scheme_apply(eload, 3, a);
00225           } else {
00226             Scheme_Object *a[1], *nsreq;
00227             char *name;
00228             nsreq = scheme_builtin_value("namespace-require");
00229             if (fa->eval_kind[i] == mzcmd_REQUIRE_LIB) {
00230               name = "lib";
00231             } else if (fa->eval_kind[i] == mzcmd_REQUIRE_PLANET) {
00232               name = "planet";
00233             } else {
00234               name = "file";
00235             }
00236             a[0] = scheme_make_pair(scheme_intern_symbol(name),
00237                                     scheme_make_pair(scheme_make_utf8_string(fa->evals_and_loads[i]),
00238                                                      scheme_make_null()));
00239             scheme_apply(nsreq, 1, a);
00240           }
00241         } else {
00242          exit_val = 1;
00243          p->error_buf = save;
00244          break;
00245        }
00246        p->error_buf = save;
00247       } else if (fa->eval_kind[i] == mzcmd_MAIN) {
00248        Scheme_Thread * volatile p;
00249        p = scheme_get_current_thread();
00250        save = p->error_buf;
00251        p->error_buf = &newbuf;
00252        if (!scheme_setjmp(newbuf)) {
00253          Scheme_Object *e, *a[2], *d2s, *nsi, *idb, *b, *cp;
00254 
00255           d2s = scheme_builtin_value("datum->syntax");
00256           a[0] = scheme_make_false();
00257           e = scheme_intern_symbol("main");
00258           a[1] = e;
00259           e = scheme_apply(d2s, 2, a);
00260 
00261           nsi = scheme_builtin_value("namespace-syntax-introduce");
00262           a[0] = e;
00263           e = scheme_apply(nsi, 1, a);
00264 
00265           /* Check that `main' is imported and/or defined: */
00266           idb = scheme_builtin_value("identifier-binding");
00267           a[0] = e;
00268           b = scheme_apply(idb, 1, a);
00269           if (b == scheme_make_false()) {
00270             if (!scheme_lookup_global(scheme_intern_symbol("main"), fa->global_env)) {
00271               scheme_signal_error("main: not defined or required into the top-level environment");
00272             }
00273           }
00274 
00275           e = scheme_make_pair(e, scheme_vector_to_list(fa->main_args));
00276           e = scheme_datum_to_kernel_stx(e);
00277           
00278          e = scheme_eval_multi_with_prompt(e, fa->global_env);
00279 
00280           if (SAME_OBJ(e, SCHEME_MULTIPLE_VALUES)) {
00281             Scheme_Object **mv;
00282             int cnt;
00283             mv = p->ku.multiple.array;
00284             cnt = p->ku.multiple.count;
00285             scheme_detach_multple_array(mv);
00286             e = scheme_make_null();
00287             while (cnt--) {
00288               e = scheme_make_pair(mv[cnt], e);
00289             }
00290           } else {
00291             e = scheme_make_pair(e, scheme_make_null());
00292           }
00293 
00294           cp = scheme_get_param(scheme_current_config(), MZCONFIG_PRINT_HANDLER);
00295           
00296           while (SCHEME_PAIRP(e)) {
00297             a[0] = SCHEME_CAR(e);
00298             scheme_apply_multi(cp, 1, a);
00299             e = SCHEME_CDR(e);
00300           }
00301        } else {
00302          exit_val = 1;
00303          p->error_buf = save;
00304          break;
00305        }
00306        p->error_buf = save;
00307       }
00308     }
00309   }
00310 #endif /* DONT_PARSE_COMMAND_LINE */
00311 
00312 #ifdef STANDALONE_WITH_EMBEDDED_EXTENSION
00313   {
00314     Scheme_Object *f, *a[1];
00315     mz_jmp_buf * volatile save, newbuf;
00316     Scheme_Thread * volatile p;
00317     p = scheme_get_current_thread();
00318     save = p->error_buf;
00319     p->error_buf = &newbuf;
00320     if (!scheme_setjmp(newbuf)) {
00321       f = scheme_initialize(fa->global_env);
00322       a[0] = scheme_make_true();
00323       f = _scheme_apply_multi(f, 1, a);
00324       if (SAME_OBJ(f, SCHEME_MULTIPLE_VALUES)
00325          && (scheme_multiple_count == 2)) {
00326        f = scheme_multiple_array[0];
00327        scheme_apply_multi_with_prompt(f, 0, NULL);
00328       }
00329     } else {
00330       exit_val = 1;
00331     }
00332     p->error_buf = save;
00333   }
00334 #endif
00335 
00336 #ifndef DONT_LOAD_INIT_FILE
00337   if (fa->a->use_repl && !fa->a->no_init_file) {
00338     char *filename;
00339     filename = GET_INIT_FILENAME(fa->global_env);
00340     if (filename) {
00341       filename = scheme_expand_filename(filename, -1, "startup", NULL, SCHEME_GUARD_FILE_EXISTS);
00342       if (scheme_file_exists(filename))
00343        scheme_load(filename);
00344     }
00345   }
00346 #endif /* DONT_LOAD_INIT_FILE */
00347 
00348 #ifndef DONT_RUN_REP
00349   if (fa->a->use_repl) {
00350     /* enter read-eval-print loop */
00351     mz_jmp_buf * volatile save, newbuf;
00352     Scheme_Thread * volatile p;
00353     p = scheme_get_current_thread();
00354     save = p->error_buf;
00355     p->error_buf = &newbuf;
00356     if (!scheme_setjmp(newbuf)) {
00357       repl(fa->global_env);
00358       exit_val = 0;
00359     } else {
00360       exit_val = 1;
00361 #ifdef YIELD_BEFORE_EXIT
00362       fa->a->add_yield = 0;
00363 #endif
00364     }
00365     p->error_buf = save;
00366   }
00367 #endif /* DONT_RUN_REP */
00368 
00369 #ifdef YIELD_BEFORE_EXIT
00370   if (fa->a->add_yield) {
00371     mz_jmp_buf * volatile save, newbuf;
00372     Scheme_Thread * volatile p;
00373     p = scheme_get_current_thread();
00374     save = p->error_buf;
00375     p->error_buf = &newbuf;
00376     if (!scheme_setjmp(newbuf)) {
00377       yield_indefinitely();
00378     }
00379     p->error_buf = save;
00380   }
00381 #endif
00382 
00383   return exit_val;
00384 }
00385 
00386 static Scheme_Object *reverse_path_list(Scheme_Object *l, int rel_to_cwd)
00387 {
00388   Scheme_Object *r, *path;
00389 
00390   r = scheme_make_null();
00391   while (SCHEME_PAIRP(l)) {
00392     path = SCHEME_CAR(l);
00393     if (rel_to_cwd)
00394       path = scheme_path_to_complete_path(path, NULL);
00395     r = scheme_make_pair(path, r);
00396     l = SCHEME_CDR(l);
00397   }
00398   
00399   return r;
00400 }   
00401 
00402 static int get_log_level(char *prog, char *real_switch, const char *envvar, const char *what, char *str)
00403 {
00404   if (!strcmp(str, "none"))
00405     return 0;
00406   else if (!strcmp(str, "fatal"))
00407     return SCHEME_LOG_FATAL;
00408   else if (!strcmp(str, "error"))
00409     return SCHEME_LOG_ERROR;
00410   else if (!strcmp(str, "warning"))
00411     return SCHEME_LOG_WARNING;
00412   else if (!strcmp(str, "info"))
00413     return SCHEME_LOG_INFO;
00414   else if (!strcmp(str, "debug"))
00415     return SCHEME_LOG_DEBUG;
00416 
00417   PRINTF("%s: %s level %s%s%s must be one of the following:\n"
00418          "  none fatal error warning info or debug\n"
00419          " given: %s\n",
00420          prog, what, 
00421          real_switch ? "after " : "in ",
00422          real_switch ? real_switch : envvar,
00423          real_switch ? " switch" : " envrionment variable",
00424          str);
00425   return -1;
00426 }
00427 
00428 static int get_arg_log_level(char *prog, char *real_switch, const char *what, int argc, char **argv)
00429 {
00430   if (argc < 2) {
00431     PRINTF("%s: missing %s level after %s switch\n", 
00432            prog, what, real_switch);
00433     return -1;
00434   }
00435 
00436   return get_log_level(prog, real_switch, NULL, what, argv[1]);
00437 }
00438 
00439 #ifdef USE_OSKIT_CONSOLE
00440 /* Hack to disable normal input mode: */
00441 int osk_not_console = 0;
00442 #endif
00443 
00444 #ifndef MZ_XFORM
00445 # ifndef GC_CAN_IGNORE
00446 #  define GC_CAN_IGNORE 
00447 # endif
00448 #endif
00449 
00450 static int run_from_cmd_line(int argc, char *_argv[], 
00451                           Scheme_Env *(*mk_basic_env)(void),
00452                           int (*cont_run)(FinishArgs *f))
00453 {
00454   GC_CAN_IGNORE char **argv = _argv;
00455   Scheme_Env *global_env;
00456   char *prog, *sprog = NULL;
00457   Scheme_Object *sch_argv, *collects_path = NULL, *collects_extra = NULL;
00458   int i;
00459 #ifndef DONT_PARSE_COMMAND_LINE
00460   char **evals_and_loads, *real_switch = NULL, specific_switch[2];
00461   int *eval_kind, num_enl;
00462   int no_more_switches = 0;
00463   int show_vers = 0;
00464 #endif
00465 #if !defined(DONT_RUN_REP) || !defined(DONT_PARSE_COMMAND_LINE)
00466   int use_repl = 0;
00467   int script_mode = 0;
00468 #endif
00469 #if !defined(DONT_LOAD_INIT_FILE) || !defined(DONT_PARSE_COMMAND_LINE)
00470   int no_init_file = 0;
00471 #endif
00472 #ifdef YIELD_BEFORE_EXIT
00473   int add_yield = 1;
00474 #endif
00475 #ifdef CMDLINE_STDIO_FLAG
00476   int alternate_rep = 0;
00477   int no_front = 0;
00478 #endif
00479   char *init_lib = INITIAL_NAMESPACE_MODULE;
00480   int was_config_flag = 0, saw_nc_flag = 0;
00481   int no_compiled = 0;
00482   int init_ns = 0, no_init_ns = 0;
00483   int syslog_level = -1, stderr_level = -1;
00484   FinishArgs *fa;
00485   FinishArgsAtoms *fa_a;
00486 
00487 #ifdef GC_THINKS_ITS_A_DLL_BUT_ISNT
00488   DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
00489 #endif
00490 
00491   prog = argv[0];
00492   argv++;
00493   --argc;
00494   
00495 #ifdef DOS_FILE_SYSTEM
00496   {
00497     /* For consistency, strip trailing spaces and dots, and make sure the .exe
00498        extension is present. */
00499     int l = strlen(prog);
00500     if ((l > 0) && ((prog[l-1] == ' ') || (prog[l-1] == '.'))) {
00501       char *s;
00502       while ((l > 0) && ((prog[l-1] == ' ') || (prog[l-1] == '.'))) {
00503        l--;
00504       }
00505       s  = (char *)scheme_malloc_atomic(l + 1);
00506       memcpy(s, prog, l);
00507       s[l] = 0;
00508       prog = s;
00509     }
00510     if (l <= 4 
00511        || (prog[l - 4] != '.')
00512        || (tolower(((unsigned char *)prog)[l - 3]) != 'e')
00513        || (tolower(((unsigned char *)prog)[l - 2]) != 'x')
00514        || (tolower(((unsigned char *)prog)[l - 1]) != 'e')) {
00515       char *s;
00516       s  = (char *)scheme_malloc_atomic(l + 4 + 1);
00517       memcpy(s, prog, l);
00518       memcpy(s + l, ".exe", 5);
00519       prog = s;
00520     }
00521   }
00522 #endif
00523   
00524   /* If cmdline_exe_hack is changed, then we extract built-in
00525      arguments. */
00526   if (cmdline_exe_hack[0] != '[') {
00527     int n, i;
00528     long d;
00529     GC_CAN_IGNORE unsigned char *p;
00530     GC_CAN_IGNORE unsigned char *orig_p;
00531     char **argv2;
00532 
00533 #ifdef DOS_FILE_SYSTEM
00534     if ((cmdline_exe_hack[0] == '?')
00535        || (cmdline_exe_hack[0] == '*')) {
00536       /* This is how we make launchers in Windows.
00537         The cmdline is appended to the end of the binary.
00538         The long integer at cmdline_exe_hack[4] says
00539         where the old end was, and cmdline_exe_hack[8]
00540         says how long the cmdline string is. It might
00541         be relative to the executable. */
00542       wchar_t *path;
00543       HANDLE fd;
00544 
00545       path = (wchar_t *)malloc(1024 * sizeof(wchar_t));
00546       GetModuleFileNameW(NULL, path, 1024);
00547       fd = CreateFileW(path, GENERIC_READ,
00548                      FILE_SHARE_READ | FILE_SHARE_WRITE,
00549                      NULL,
00550                      OPEN_EXISTING,
00551                      0,
00552                      NULL);
00553       if (fd == INVALID_HANDLE_VALUE)
00554        p = (unsigned char *)"\0\0\0";
00555       else {
00556        long start, len;
00557        DWORD got;
00558        start = *(long *)&cmdline_exe_hack[4];
00559        len = *(long *)&cmdline_exe_hack[8];
00560        p = (unsigned char *)malloc(len);
00561        SetFilePointer(fd, start, 0, FILE_BEGIN);
00562        ReadFile(fd, p, len, &got, NULL);
00563        CloseHandle(fd);
00564        if (got != len)
00565          p = (unsigned char *)"\0\0\0";
00566        else if (cmdline_exe_hack[0] == '*') {
00567          /* "*" means that the first item is argv[0] replacement: */
00568          sprog = prog;
00569          prog = (char *)p + 4;
00570 
00571          if ((prog[0] == '\\')
00572              || ((((prog[0] >= 'a') && (prog[0] <= 'z'))
00573                  ||  ((prog[0] >= 'A') && (prog[0] <= 'Z')))
00574                 && (prog[1] == ':'))) {
00575            /* Absolute path */
00576          } else {
00577            /* Make it absolute, relative to this executable */
00578            int plen = strlen(prog);
00579            int mlen, len;
00580            char *s2, *p2;
00581 
00582            /* UTF-8 encode path: */
00583            for (len = 0; path[len]; len++) { }
00584            mlen = scheme_utf8_encode((unsigned int *)path, 0, len,
00585                                   NULL, 0,
00586                                   1 /* UTF-16 */);
00587            p2 = (char *)malloc(mlen + 1);
00588            mlen = scheme_utf8_encode((unsigned int *)path, 0, len,
00589                                   (unsigned char *)p2, 0,
00590                                   1 /* UTF-16 */);
00591 
00592            while (mlen && (p2[mlen - 1] != '\\')) {
00593              mlen--;
00594            }
00595            s2 = (char *)malloc(mlen + plen + 1);
00596            memcpy(s2, p2, mlen);
00597            memcpy(s2 + mlen, prog, plen + 1);
00598            prog = s2;
00599          }
00600 
00601          p += (p[0]
00602               + (((long)p[1]) << 8)
00603               + (((long)p[2]) << 16)
00604               + (((long)p[3]) << 24)
00605               + 4);
00606        }
00607       }
00608     } else
00609 #endif
00610       p = (unsigned char *)cmdline_exe_hack + 1;
00611 
00612     /* Command line is encoded as a sequence of pascal-style strings;
00613        we use four whole bytes for the length, though, little-endian. */
00614 
00615     orig_p = p;
00616 
00617     n = 0;
00618     while (p[0] || p[1] || p[2] || p[3]) {
00619       n++;
00620       p += (p[0]
00621            + (((long)p[1]) << 8)
00622            + (((long)p[2]) << 16)
00623            + (((long)p[3]) << 24)
00624            + 4);
00625     }
00626     
00627     argv2 = (char **)malloc(sizeof(char *) * (argc + n));
00628     p = orig_p;
00629     for (i = 0; i < n; i++) {
00630       d = (p[0]
00631           + (((long)p[1]) << 8)
00632           + (((long)p[2]) << 16)
00633           + (((long)p[3]) << 24));
00634       argv2[i] = (char *)p + 4;
00635       p += d + 4;
00636     }
00637     for (; i < n + argc; i++) {
00638       argv2[i] = argv[i - n];
00639     }
00640     argv = argv2;
00641     argc += n;
00642   }
00643 
00644 #ifndef DONT_PARSE_COMMAND_LINE
00645   evals_and_loads = (char **)malloc(sizeof(char *) * argc);
00646   eval_kind = (int *)malloc(sizeof(int) * argc);
00647   num_enl = 0;
00648 
00649   while (!no_more_switches && argc && argv[0][0] == '-' && !is_number_arg(argv[0] + 1)) {
00650     real_switch = argv[0];
00651 
00652     if (!strcmp("--help", argv[0]))
00653       argv[0] = "-h";
00654     else if (!strcmp("--eval", argv[0]))
00655       argv[0] = "-e";
00656     else if (!strcmp("--load", argv[0]))
00657       argv[0] = "-f";
00658     else if (!strcmp("--require", argv[0]))
00659       argv[0] = "-t";
00660     else if (!strcmp("--lib", argv[0]))
00661       argv[0] = "-l";
00662     else if (!strcmp("--script", argv[0]))
00663       argv[0] = "-r";
00664     else if (!strcmp("--require-script", argv[0]))
00665       argv[0] = "-u";
00666     else if (!strcmp("--main", argv[0]))
00667       argv[0] = "-m";
00668     else if (!strcmp("--name", argv[0]))
00669       argv[0] = "-N";
00670     else if (!strcmp("--no-compiled", argv[0]))
00671       argv[0] = "-c";
00672     else if (!strcmp("--no-lib", argv[0]))
00673       argv[0] = "-n";
00674     else if (!strcmp("--version", argv[0]))
00675       argv[0] = "-v";
00676     else if (!strcmp("--no-init-file", argv[0]))
00677       argv[0] = "-q";
00678     else if (!strcmp("--no-jit", argv[0]))
00679       argv[0] = "-j";
00680     else if (!strcmp("--no-delay", argv[0]))
00681       argv[0] = "-d";
00682     else if (!strcmp("--no-argv", argv[0]))
00683       argv[0] = "-A";
00684     else if (!strcmp("--repl", argv[0]))
00685       argv[0] = "-i";
00686     else if (!strcmp("--binary", argv[0]))
00687       argv[0] = "-b";
00688     else if (!strcmp("--warn", argv[0]))
00689       argv[0] = "-W";
00690     else if (!strcmp("--syslog", argv[0]))
00691       argv[0] = "-L";
00692     else if (!strcmp("--collects", argv[0]))
00693       argv[0] = "-X";
00694     else if (!strcmp("--search", argv[0]))
00695       argv[0] = "-S";
00696 # ifdef CMDLINE_STDIO_FLAG
00697     else if (!strcmp("--stdio", argv[0]))
00698       argv[0] = "-z";
00699     else if (!strcmp("--back", argv[0]))
00700       argv[0] = "-G";
00701 # endif
00702 # ifdef YIELD_BEFORE_EXIT
00703     else if (!strcmp("--no-yield", argv[0]))
00704       argv[0] = "-V";
00705 # endif
00706     
00707     if (!argv[0][1] || (argv[0][1] == '-' && argv[0][2])) {
00708       specific_switch[0] = 0;
00709       goto bad_switch;
00710     } else {
00711       GC_CAN_IGNORE char *str;
00712       char *se;
00713       for (str = argv[0] + 1; *str; str++) {
00714        switch (*str) {
00715        case 'h':
00716          goto show_help;
00717          break;
00718        case 'e':
00719          if (argc < 2) {
00720            PRINTF("%s: missing expression after %s switch\n", 
00721                  prog, real_switch);
00722            goto show_need_help;
00723          }
00724          argv++;
00725          --argc;
00726          evals_and_loads[num_enl] = argv[0];
00727          eval_kind[num_enl++] = mzcmd_EVAL;
00728           init_ns = 1;
00729          break;
00730        case 'X':
00731          if (argc < 2) {
00732            PRINTF("%s: missing path after %s switch\n", 
00733                  prog, real_switch);
00734            goto show_need_help;
00735          }
00736          argv++;
00737          --argc;
00738          collects_path = scheme_make_path(argv[0]);
00739           was_config_flag = 1;
00740          break;
00741        case 'U':
00742          scheme_set_ignore_user_paths(1);
00743           was_config_flag = 1;
00744          break;
00745         case 'I':
00746           if (argc < 2) {
00747            PRINTF("%s: missing path after %s switch\n", 
00748                  prog, real_switch);
00749            goto show_need_help;
00750          }
00751          argv++;
00752          --argc;
00753          init_lib = argv[0];
00754           was_config_flag = 1;
00755           break;
00756        case 'S':
00757          if (argc < 2) {
00758            PRINTF("%s: missing path after %s switch\n", 
00759                  prog, real_switch);
00760            goto show_need_help;
00761          }
00762          argv++;
00763          --argc;
00764          if (!collects_extra)
00765            collects_extra = scheme_make_null();
00766           collects_extra = scheme_make_pair(scheme_make_path(argv[0]), collects_extra);
00767           was_config_flag = 1;
00768          break;
00769         case 'c':
00770           no_compiled = 1;
00771           was_config_flag = 1;
00772           break;
00773        case 'm':
00774           evals_and_loads[num_enl] = "";
00775           eval_kind[num_enl++] = mzcmd_MAIN;
00776           init_ns = 1;
00777          break;
00778        case 'r':
00779          script_mode = 1;
00780          no_more_switches = 1;
00781           if (argc > 1)
00782             sprog = argv[1];
00783        case 'f':
00784          if (argc < 2) {
00785            PRINTF("%s: missing file name after %s switch\n", 
00786                  prog, real_switch);
00787            goto show_need_help;
00788          }
00789          argv++;
00790          --argc;
00791          evals_and_loads[num_enl] = argv[0];
00792          eval_kind[num_enl++] = mzcmd_LOAD;
00793           init_ns = 1;
00794          break;
00795        case 'u':
00796          script_mode = 1;
00797          no_more_switches = 1;
00798           if (argc > 1)
00799             sprog = argv[1];
00800        case 't':
00801          if (argc < 2) {
00802            PRINTF("%s: missing file name after %s switch\n", 
00803                  prog, real_switch);
00804            goto show_need_help;
00805          }
00806          argv++;
00807          --argc;
00808          evals_and_loads[num_enl] = argv[0];
00809          eval_kind[num_enl++] = mzcmd_REQUIRE_FILE;
00810           if (!init_ns)
00811             no_init_ns = 1;
00812          break;
00813        case 'l':
00814          if (argc < 2) {
00815            PRINTF("%s: missing library name after %s switch\n", 
00816                  prog, real_switch);
00817            goto show_need_help;
00818          }
00819          argv++;
00820          --argc;
00821          evals_and_loads[num_enl] = argv[0];
00822          eval_kind[num_enl++] = mzcmd_REQUIRE_LIB;
00823           if (!init_ns)
00824             no_init_ns = 1;
00825          break;
00826        case 'p':
00827          if (argc < 2) {
00828            PRINTF("%s: missing package name after %s switch\n", 
00829                  prog, real_switch);
00830            goto show_need_help;
00831          }
00832          argv++;
00833          --argc;
00834          evals_and_loads[num_enl] = argv[0];
00835          eval_kind[num_enl++] = mzcmd_REQUIRE_PLANET;
00836           if (!init_ns)
00837             no_init_ns = 1;
00838          break;
00839        case 'k':
00840          if (argc < 3) {
00841            PRINTF("%s: missing %s after %s switch\n", 
00842                  prog, 
00843                  (argc < 2) ? "starting and ending offsets" : "ending offset",
00844                  real_switch);
00845            goto show_need_help;
00846          }
00847          argv++;
00848          --argc;
00849          se = make_embedded_load(argv[0], argv[1]);
00850          evals_and_loads[num_enl] = se;
00851          argv++;
00852          --argc;
00853          eval_kind[num_enl++] = mzcmd_EMBEDDED;
00854          break;
00855        case 'N':
00856          if (argc < 2) {
00857            PRINTF("%s: missing name after %s switch\n", 
00858                  prog, 
00859                  real_switch);
00860            goto show_need_help;
00861          }
00862          argv++;
00863          --argc;
00864          sprog = argv[0];
00865           was_config_flag = 1;
00866          break;
00867        case 'q':
00868          no_init_file = 1;
00869           was_config_flag = 1;
00870          break;
00871         case 'n':
00872           no_init_ns = 1;
00873           break;
00874        case 'v':
00875          show_vers = 1;
00876          break;
00877 #ifdef YIELD_BEFORE_EXIT
00878        case 'V':
00879          show_vers = 1;
00880          add_yield = 0;
00881          break;
00882 #endif
00883        case 'i':
00884          use_repl = 1;
00885           init_ns = 1;
00886          break;
00887        case '-':
00888          no_more_switches = 1;
00889           was_config_flag = 1;
00890          break;
00891        case 'j':
00892          scheme_set_startup_use_jit(0);
00893           was_config_flag = 1;
00894          break;
00895        case 'd':
00896          scheme_set_startup_load_on_demand(0);
00897           was_config_flag = 1;
00898          break;
00899        case 'b':
00900          scheme_set_binary_mode_stdio(1);
00901           was_config_flag = 1;
00902          break;
00903 #ifdef CMDLINE_STDIO_FLAG
00904               case 'z':
00905          alternate_rep = 1;
00906          no_front = 1;
00907           was_config_flag = 1;
00908          break;
00909        case 'K':
00910          no_front = 1;
00911          break;
00912 #endif
00913 #ifdef USE_OSKIT_CONSOLE
00914        case 'S':
00915          osk_not_console = 1;
00916          break;
00917 #endif
00918         case 'W':
00919           stderr_level = get_arg_log_level(prog, real_switch, "stderr", argc, argv);
00920           if (stderr_level < 0)
00921             goto show_need_help;
00922           --argc;
00923           argv++;
00924           was_config_flag = 1;
00925           break;
00926        case 'L':
00927           syslog_level = get_arg_log_level(prog, real_switch, "syslog", argc, argv);
00928           if (syslog_level < 0)
00929             goto show_need_help;
00930           --argc;
00931           argv++;
00932           was_config_flag = 1;
00933           break;
00934        default:
00935           specific_switch[0] = *str;
00936           specific_switch[1] = 0;
00937          goto bad_switch;
00938        }
00939 
00940         if (was_config_flag)
00941           was_config_flag = 0;
00942         else
00943           saw_nc_flag = 1;
00944       }
00945       argv++;
00946       --argc;
00947     }
00948   }
00949 
00950   if (!saw_nc_flag) {
00951     if (!argc) {
00952       /* No args => repl */
00953       use_repl = 1;
00954       init_ns = 1;
00955     } else if (argv[0][0] != '-') {
00956       /* No switches => -u mode */
00957       script_mode = 1;
00958       no_more_switches = 1;
00959       sprog = argv[0];
00960       evals_and_loads[num_enl] = argv[0];
00961       eval_kind[num_enl++] = mzcmd_REQUIRE_FILE;
00962       argv++;
00963       --argc;
00964     }
00965   }
00966 
00967   if (use_repl) {
00968     show_vers = 1;
00969   }
00970 
00971   if (no_init_ns)
00972     init_ns = 0;
00973 
00974   if (show_vers) {
00975 #ifndef MZSCHEME_CMD_LINE  
00976     if (!use_repl
00977 #ifdef CMDLINE_STDIO_FLAG
00978        || alternate_rep
00979 #endif
00980        )
00981 #endif
00982       PRINTF(BANNER);
00983 #ifdef MZSCHEME_CMD_LINE  
00984 # ifdef DOS_FILE_SYSTEM
00985 #  if !defined(FILES_HAVE_FDS)
00986 #   if !defined(WINDOWS_FILE_HANDLES)
00987     PRINTF("Warning: read-eval-print-loop or read on a stream port may block threads.\n");
00988 #   endif
00989 #  endif
00990 # endif
00991 #endif
00992 
00993 #if defined(USE_FD_PORTS) || defined(WINDOWS_FILE_HANDLES)
00994    fflush(stdout);
00995 #endif
00996   }
00997 #endif /* DONT_PARSE_COMMAND_LINE */
00998 
00999 #ifdef GETENV_FUNCTION
01000   if (syslog_level < 0) {
01001     char *s;
01002     s = getenv("PLTSYSLOG");
01003     if (s) {
01004       syslog_level = get_log_level(prog, NULL, "PLTSYSLOG", "syslog", s);
01005     }
01006   }
01007   if (stderr_level < 0) {
01008     char *s;
01009     s = getenv("PLTSTDERR");
01010     if (s) {
01011       stderr_level = get_log_level(prog, NULL, "PLTSTDERR", "stderr", s);
01012     }
01013   }
01014 #endif
01015 
01016   scheme_set_logging(syslog_level, stderr_level);
01017 
01018   global_env = mk_basic_env();
01019 
01020   sch_argv = scheme_make_vector(argc, NULL);
01021   for (i = 0; i < argc; i++) {
01022     Scheme_Object *so;
01023     so = scheme_make_locale_string(argv[i]);
01024     SCHEME_SET_CHAR_STRING_IMMUTABLE(so);
01025     SCHEME_VEC_ELS(sch_argv)[i] = so;
01026   }
01027   if (argc)
01028     SCHEME_SET_VECTOR_IMMUTABLE(sch_argv);
01029   scheme_set_param(scheme_current_config(), MZCONFIG_CMDLINE_ARGS, sch_argv);
01030 
01031   if (no_compiled)
01032     scheme_set_param(scheme_current_config(), MZCONFIG_USE_COMPILED_KIND, scheme_make_null());
01033 
01034   {    
01035     Scheme_Object *ps;
01036     scheme_set_exec_cmd(prog);
01037     if (!sprog)
01038       sprog = prog;
01039   
01040     ps = scheme_set_run_cmd(sprog);
01041   }
01042 
01043 #ifndef NO_FILE_SYSTEM_UTILS
01044   /* Setup path for "collects" collection directory: */
01045   {
01046     Scheme_Object *l, *r;
01047     int len, offset;
01048 
01049     if (!collects_path)
01050       collects_path = scheme_make_path(_coldir XFORM_OK_PLUS _coldir_offset);
01051     else
01052       collects_path = scheme_path_to_complete_path(collects_path, NULL);
01053     scheme_set_collects_path(collects_path);
01054 
01055     /* Make list of additional collection paths: */
01056     if (collects_extra)
01057       r = reverse_path_list(collects_extra, 1);
01058     else
01059       r = scheme_make_null();
01060 
01061     l = scheme_make_null();
01062     offset = _coldir_offset;
01063     while (1) {
01064       len = strlen(_coldir XFORM_OK_PLUS offset);
01065       offset += len + 1;
01066       if (!_coldir[offset])
01067         break;
01068       l = scheme_make_pair(scheme_make_path(_coldir XFORM_OK_PLUS offset),
01069                            l);
01070     }
01071     l = reverse_path_list(l, 0);
01072 
01073     scheme_init_collection_paths_post(global_env, l, r);
01074   }
01075 #endif /* NO_FILE_SYSTEM_UTILS */
01076 
01077   fa_a = (FinishArgsAtoms *)scheme_malloc_atomic(sizeof(FinishArgsAtoms));
01078   fa = (FinishArgs *)scheme_malloc(sizeof(FinishArgs));
01079   fa->a = fa_a;
01080   fa->a->init_ns = init_ns;
01081 #ifndef DONT_PARSE_COMMAND_LINE
01082   fa->evals_and_loads = evals_and_loads;
01083   fa->eval_kind = eval_kind;
01084   fa->a->num_enl = num_enl;
01085   fa->main_args = sch_argv;
01086 #endif  
01087 #ifndef DONT_LOAD_INIT_FILE
01088   fa->a->no_init_file = no_init_file;
01089 #endif
01090 #ifndef DONT_RUN_REP
01091   fa->a->use_repl = use_repl;
01092   fa->a->script_mode = script_mode;
01093 #endif
01094 #ifdef YIELD_BEFORE_EXIT
01095   fa->a->add_yield = add_yield;
01096 #endif
01097 #ifdef CMDLINE_STDIO_FLAG
01098   fa->a->alternate_rep = alternate_rep;
01099   fa->a->no_front = no_front;
01100 #endif
01101   fa->init_lib = init_lib;
01102   fa->global_env = global_env;
01103 
01104   scheme_set_can_break(1);
01105 
01106   return cont_run(fa);
01107 
01108 #ifndef DONT_PARSE_COMMAND_LINE
01109  show_help:
01110   prog =("%s"
01111          PROGRAM_LC " [<option> ...] <argument> ...\n"
01112 # ifndef MZSCHEME_CMD_LINE
01113 #  ifdef wx_x
01114         " X configuration options (must precede all other options):\n"
01115         "  -display <display>, -geometry <geometry>, -fn <font>, -font <font>,\n"
01116          "  -bg <color>, -background <color>, -fg <color>, -foreground <color>,\n"
01117         "  -iconic, -name <name>, -rv, -reverse, +rv, -selectionTimeout <timeout>,\n"
01118         "  -synchronous, -title <title>, -xnllanguage <language>, -xrm <file>\n"
01119 #  endif
01120 # endif
01121         " File and expression options:\n"
01122         "  -e <exprs>, --eval <exprs> : Evaluate <exprs>, prints results\n"
01123         "  -f <file>, --load <file> : Like -e '(load \"<file>\")' without printing\n"
01124         "  -t <file>, --require <file> : Like -e '(require (file \"<file>\"))'\n"
01125         "  -l <path>, --lib <path> : Like -e '(require (lib \"<path>\"))'\n"
01126         "  -p <package> : Like -e '(require (planet \"<package>\")'\n"
01127         "  -r <file>, --script <file> : Same as -f <file> -N <file> --\n" 
01128         "  -u <file>, --require-script <file> : Same as -t <file> -N <file> --\n" 
01129         "  -k <n> <m> : Load executable-embedded code from file offset <n> to <m>\n"
01130         "  -m, --main : Call `main' with command-line arguments, print results\n"
01131         " Interaction options:\n"
01132          "  -i, --repl : Run interactive read-eval-print loop; implies -v\n"
01133          "  -n, --no-lib : Skip `(require (lib \"<init-lib>\"))' for -i/-e/-f/-r\n"
01134         "  -v, --version : Show version\n"
01135 # ifdef CMDLINE_STDIO_FLAG
01136         "  -K, --back : Don't bring application to the foreground (Mac OS X)\n"
01137 # endif
01138 # ifdef YIELD_BEFORE_EXIT
01139         "  -V, --no-yield : Don't `(yield 'wait)'\n"
01140 # endif
01141         " Configuration options:\n"
01142          "  -c, --no-compiled : Disable loading of compiled files\n"
01143         "  -q, --no-init-file : Skip load of " INIT_FILENAME " for -i\n"
01144 # ifdef CMDLINE_STDIO_FLAG
01145         "  -z, --text-repl : Use text read-eval-print loop for -i\n"
01146 # endif
01147          "  -I <path> : Set <init-lib> to <path>\n"
01148         "  -X <dir>, --collects <dir> : Main collects at <dir>\n"
01149         "  -S <dir>, --search <dir> : More collects at <dir> (after main collects)\n"
01150         "  -U, --no-user-path : Ignore user-specific collects, etc.\n"
01151         "  -N <file>, --name <file> : Sets `(find-system-path 'run-file)' to <file>\n"
01152 # ifdef MZ_USE_JIT
01153         "  -j, --no-jit : Disable the just-in-time compiler\n"
01154 # else
01155         "  -j, --no-jit : No effect, since the just-in-time compiler is unavailable\n"
01156 # endif
01157          "  -d, --no-delay: Disable on-demand loading of syntax and code\n"
01158         "  -b, --binary : Read stdin and write stdout/stderr in binary mode\n"
01159         "  -W <level>, --warn <level> : Set stderr logging to <level>\n"
01160         "  -L <level>, --syslog <level> : Set syslog logging to <level>\n"
01161         " Meta options:\n"
01162         "  -- : No argument following this switch is used as a switch\n"
01163         "  -h, --help : Show this information and exits, ignoring other options\n"
01164          "Default options:\n"
01165          " If only configuration options are provided, -i is added\n"
01166          " If only configuration options are before the first argument, -u is added\n"
01167          " If -t/-l/-p/-u apears before the first -i/-e/-f/-r, -n is added\n"
01168          " <init-lib> defaults to " INITIAL_NAMESPACE_MODULE "\n"
01169          "Switch syntax:\n"
01170         " Multiple single-letter switches can be collapsed, with arguments placed\n"
01171         "   after the collapsed switches; the first collapsed switch cannot be --\n"
01172         " Example: `-ifve file expr' is the same as `-i -f file -v -e expr'\n"
01173          "Start-up sequence:\n"
01174          " 1. Set `current-library-collection-paths'\n"
01175          " 2. Require `(lib \"<init-lib>\")' [when -i/-e/-f/-r, unless -n]\n"
01176          " 3. Evaluate/load expressions/files in order, until first error\n"
01177          " 4. Load \"" INIT_FILENAME "\" [when -i]\n"
01178          " 5. Run read-eval-print loop [when -i]\n"
01179 # ifdef YIELD_BEFORE_EXIT
01180          " 6. Run `(yield 'wait)' [unless -V]\n"
01181 # endif
01182         );
01183   PRINTF(prog, BANNER);
01184 #if defined(WINDOWS_FILE_HANDLES)
01185   fflush(stdout);
01186 #endif
01187   return 0;
01188  bad_switch:
01189   if (specific_switch[0] && real_switch[2]) {
01190     PRINTF("%s: bad switch: -%s within: %s\n", prog, specific_switch, real_switch);
01191   } else {
01192     PRINTF("%s: bad switch: %s\n", prog, real_switch);
01193   }
01194  show_need_help:
01195   PRINTF("Use the --help or -h flag for help.\n");
01196 #if defined(DETECT_WIN32_CONSOLE_STDIN)
01197   fflush(stdout);
01198 #endif
01199   return 1;
01200 #endif
01201 }
01202 
01203 #if defined(OS_X) && defined(MZ_PRECISE_GC) && defined(EXTRA_EXCEPTION_STUBS)
01204 
01205 /* These declarations avoid linker problems when using
01206    -mmacosx-version-min. See gc2/vm_osx.c for details. */
01207 
01208 START_XFORM_SKIP;
01209 
01210 #include <mach/mach.h>
01211 #include <mach/mach_error.h>
01212 
01213 # ifdef __cplusplus
01214 extern "C" {
01215 # endif
01216 
01217 extern kern_return_t GC_catch_exception_raise_state(mach_port_t port,
01218                                                     exception_type_t exception_type,
01219                                                     exception_data_t exception_data,
01220                                                     mach_msg_type_number_t data_cnt,
01221                                                     thread_state_flavor_t *flavor,
01222                                                     thread_state_t in_state,
01223                                                     mach_msg_type_number_t is_cnt,
01224                                                     thread_state_t out_state,
01225                                                     mach_msg_type_number_t os_cnt);
01226 extern kern_return_t GC_catch_exception_raise_state_identitity
01227   (mach_port_t port,  mach_port_t thread_port, mach_port_t task_port,
01228    exception_type_t exception_type, exception_data_t exception_data,
01229    mach_msg_type_number_t data_count, thread_state_flavor_t *state_flavor,
01230    thread_state_t in_state, mach_msg_type_number_t in_state_count,
01231    thread_state_t out_state, mach_msg_type_number_t out_state_count);
01232 extern kern_return_t GC_catch_exception_raise(mach_port_t port,
01233                                               mach_port_t thread_port,
01234                                               mach_port_t task_port,
01235                                               exception_type_t exception_type,
01236                                               exception_data_t exception_data,
01237                                               mach_msg_type_number_t data_count);
01238 
01239 kern_return_t catch_exception_raise_state(mach_port_t port,
01240                                      exception_type_t exception_type,
01241                                      exception_data_t exception_data,
01242                                      mach_msg_type_number_t data_cnt,
01243                                      thread_state_flavor_t *flavor,
01244                                      thread_state_t in_state,
01245                                      mach_msg_type_number_t is_cnt,
01246                                      thread_state_t out_state,
01247                                      mach_msg_type_number_t os_cnt)
01248 {
01249   return GC_catch_exception_raise_state(port, exception_type, exception_data,
01250                                         data_cnt, flavor,
01251                                         in_state, is_cnt,
01252                                         out_state, os_cnt);
01253 }
01254 
01255 kern_return_t catch_exception_raise_state_identitity
01256   (mach_port_t port,  mach_port_t thread_port, mach_port_t task_port,
01257    exception_type_t exception_type, exception_data_t exception_data,
01258    mach_msg_type_number_t data_count, thread_state_flavor_t *state_flavor,
01259    thread_state_t in_state, mach_msg_type_number_t in_state_count,
01260    thread_state_t out_state, mach_msg_type_number_t out_state_count)
01261 {
01262   return GC_catch_exception_raise_state_identitity(port, thread_port, task_port,
01263                                                    exception_type, exception_data,
01264                                                    data_count, state_flavor,
01265                                                    in_state, in_state_count,
01266                                                    out_state, out_state_count);
01267 }
01268 
01269 kern_return_t catch_exception_raise(mach_port_t port,
01270                                 mach_port_t thread_port,
01271                                 mach_port_t task_port,
01272                                 exception_type_t exception_type,
01273                                 exception_data_t exception_data,
01274                                 mach_msg_type_number_t data_count)
01275 {
01276   return GC_catch_exception_raise(port, thread_port, task_port,
01277                                   exception_type, exception_data, data_count);
01278 }
01279 
01280 # ifdef __cplusplus
01281 };
01282 # endif
01283 END_XFORM_SKIP;
01284 #endif