int main (void) { int argc; char **argv; char **envp; /* These variables are used by the WEL library */ ghInstance = GetModuleHandle(NULL); eif_hInstance = GetModuleHandle(NULL); eif_hPrevInstance = NULL; eif_lpCmdLine = GetCommandLine(); eif_nCmdShow = SW_SHOW; /* Initialization of the command line which is going to be passed to eiffel */ get_argcargv (&argc, &argv); /* We get ANSI version of environment variables */ envp = (char **) GetEnvironmentStringsA(); eif_alloc_init(); #ifdef EIF_THREADS eif_thr_init_root(); #endif { GTCX struct ex_vect *exvect; jmp_buf exenv; egc_init_plug(); initsig(); initstk(); exvect = exset((char *) 0, 0, (char *) 0); exvect->ex_jbuf = &exenv; if (setjmp(exenv)) failure(); eif_retrieve_root (&argc, argv); eif_rtinit(argc, argv, envp); eif_init_root(); egc_rcdt_init(); emain(argc, argv); free_argv (&argv); reclaim(); } FreeEnvironmentStringsA ((LPSTR) envp); exit(0); return 0; }
rt_public void eif_rtinit(int argc, EIF_NATIVE_CHAR **argv, EIF_NATIVE_CHAR **envp) { char *eif_timeout; /* Retrieve root argument if any and update `argc' accordingly. */ eif_retrieve_root(&argc, argv); #ifdef EIF_WINDOWS set_windows_exception_filter(); #if defined(_MSC_VER) && _MSC_VER >= 1400 /* version 14.0+ (MSVC 8.0+) */ /* Ensures consistent behavior across all our platforms where we * get 2-digit exponent up to 99 and then 3-digit exponent for 100 and * above. */ (void) _set_output_format(_TWO_DIGIT_EXPONENT); #endif #endif #ifdef BOEHM_GC GC_register_displacement (OVERHEAD); #endif ieee_init(); starting_working_directory = (char *) eif_malloc (PATH_MAX + 1); /* Initialize directory to an empty string by default. */ starting_working_directory [0] = '\0'; ufill(); /* Get urgent memory chunks */ #if defined(DEBUG) && (EIF_OS != EIF_OS_VXWORKS) && !defined(EIF_WINDOWS) /* The following install signal handlers for signals USR1 and USR2. Both * raise an immediate scanning of memory and dumping of the free list usage * and other statistics. The difference is that USR1 also performrs a full * GC cycle before runnning the diagnosis. If memck() is programmed to * panic when inconsistencies are detected, this may raise a system failure * due to race condition. There is nothing the user can do about it, except * pray--RAM. */ esignal(SIGUSR1, mem_diagnose); esignal(SIGUSR2, mem_diagnose); #endif /* Check if the user wants to override the default timeout value * for interprocess communications (IPC). This new value is specified in * the ISE_TIMEOUT environment variable */ eif_timeout = getenv("ISE_TIMEOUT"); if ((eif_timeout != NULL) && (strlen(eif_timeout) > 0)) { /* Environment variable set */ TIMEOUT = (unsigned) atoi(eif_timeout); } else { TIMEOUT = 30; } eoption = egc_foption; #ifdef WORKBENCH xinitint(); /* Interpreter initialization */ esystem = egc_fsystem; eif_par_table = egc_partab; eif_par_table_size = egc_partab_size; eorg_table = egc_forg_table; pattern = egc_fpattern; debug_initialize(); /* Initialize debug information (breakpoints ...) */ /* In workbench mode, we have a slight problem: when we link ewb in * workbench mode, since ewb is a child from ised, the run-time will * assume, wrongly, that the executable is started in debug mode. Therefore, * we need a special run-time, with no debugging hooks involved. */ #ifndef NOHOOK winit(); /* Did we start under ewb control? */ #endif /* Initialize dynamically computed variables (i.e. system dependent) * Then we may call update. Eventually, when debugging the * application, the values loaded from the update file will be overridden * by the workbench (via winit). */ egc_einit(); /* Various static initializations */ fcount = scount; { char temp = 0; int i; for (i=1;i<argc;i++) { if (0 == rt_nstrcmp (argv[i], rt_nmakestr("-ignore_updt"))) { temp = (char) 1; break; } } update(temp, argv[0]); } /* Read melted information * Note: the `update' function takes * care of the initialization of the * temporary descriptor structures */ create_desc(); /* Create descriptor (call) tables */ #else /* * Initialize the finalized system with the static data structures. */ esystem = egc_fsystem; eif_par_table = egc_partab; eif_par_table_size = egc_partab_size; eif_gen_conf_init (eif_par_table_size); nbref = egc_fnbref; esize = egc_fsize; #endif #if !defined CUSTOM || defined NEED_UMAIN_H umain(argc, argv, envp); /* User's initializations */ #endif #if !defined CUSTOM || defined NEED_ARGV_H rt_arg_init(argc, argv); /* Save copy for class ARGUMENTS */ #endif eif_environ = envp; /* Save pointer to environment variable storage */ once_init(); #if defined(EIF_THREADS) && defined(WORKBENCH) notify_root_thread(); #endif initprf(); /* Initialize profiler. */ init_emnger(); /* Initialize ISE_EXCEPTION_MANAGER */ init_scp_manager(); /* Initialize ISE_SCOOP_MANAGER */ /* Initialize our root class. */ eif_init_root(); }